Time needed: 30 minutes.

If you have a particularly large hosted on WP Engine that you want to develop for locally with Devkit, you’re probably not too happy about having to store all the uploads locally. Here’s a method to rewrite the local wp-content/uploads/ path to pull images and other content from your live site instead…

  1. Create a new local project (if none already exists):

    wpe project new LOCALPROJECTNAME
    *replace LOCALPROJECTNAME with whatever you like

  2. CD into the local project directory

    cd LOCALPROJECTNAME

  3. Pair the local project with a live install on WP Engine:

    wpe config set prod_install LIVEINSTALLNAME
    *replace LIVEINSTALLNAME with your actual WP Engine live install name

  4. Pull the live install site down to the local project environment:

    wpe clone LIVEINSTALLNAME
    *replace LIVEINSTALLNAME with your actual WP Engine live install name

  5. Modify the line in the file .gitignore that excludes the database:

    /wp-content/mysql.sql to #/wp-content/mysql.sql

  6. Perform a pull from the live site (which will remove the uploads folder contents):

    wpe alpha pull LIVEINSTALLNAME
    *replace LIVEINSTALLNAME with your actual WP Engine live install name

  7. Add these 2 lines to your wp-config.php to tell your local WordPress site to pull content from the live site:

    define("WP_CONTENT_URL", "http://LIVEDOMAIN.COM/wp-content");
    define("COOKIE_DOMAIN", "LOCALDOMAIN.COM.");
    *replace LIVEDOMAIN.COM with your live URL and LOCALDOMAIN.COM with your local test domain

  8. All done!

    Open your local test domain in an incognito/private window and inspect the page source to make sure the contents are loading correctly from the live domain and not your local machine.

Elementor Page Builder

Related Articles

Copyright © 2019 Nodeflame

HOW TO: Load wp-content/uploads from a live site on a local WP Engine Devkit environment

by nodeflame time to read: 1 min