Running a WordPress site with WP-ENV

You need to install WP-ENV globally or project based first. Then, create a “.wp-env.json” file to the root folder which has “wp-content” folder in it.

.wp-env.json: (Most optimized config, here for details)

    "core": "",
    "port": 80,
    "mappings": {
        "wp-content/": "./wp/wp-content"
    "env": {
        "tests": {
            "port": 8080
Code language: JSON / JSON with Comments (json)

To Run Server: (might take long at first)

wp-env startCode language: Bash (bash)

To Import Existing DB:

wp-env run cli db import wp-content/mysql.sqlCode language: Bash (bash)

To Export DB:

wp-env run cli db export wp-content/mysql.sqlCode language: Bash (bash)

Rewrite Flush: (Not working. Enter Settings > Permalinks and click “Save”)

wp-env run cli rewrite flush --hardCode language: Bash (bash)

To Reset DB:

wp-env run cli db reset --yesCode language: Bash (bash)

To update upload max size:

wp-env run cli vi .htaccessCode language: Bash (bash)

then add:

php_value upload_max_filesize "8M"Code language: JavaScript (javascript)

I also added “max_post_size” on next line.

Going into the container shell:

wp-env run cli bashCode language: Bash (bash)



, , ,




Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.