André Amorim

Crafting Web Experiences


//

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": "https://wordpress.org/wordpress-5.6-no-content.zip",
    "port": 80,
    "mappings": {
        "wp-content/": "./wp/wp-content"
    },
    "env": {
        "tests": {
            "port": 8080
        }
    }
}

To Run Server: (might take long at first)

wp-env start

To Import Existing DB:

wp-env run cli db import wp-content/mysql.sql

To Export DB:

wp-env run cli db export wp-content/mysql.sql

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

wp-env run cli rewrite flush --hard

To Reset DB:

wp-env run cli db reset --yes

To update upload max size:

wp-env run cli vi .htaccess

then add:

php_value upload_max_filesize "8M"

I also added “max_post_size” on next line.

Going into the container shell:

wp-env run cli bash

Published date:

Modified date: