Content is not updating on the site
Sometimes when updating content over SFTP, or in the WordPress Admin Dashboard, you might not see your changes reflected immediately when viewing the site. The reason for this is that our caching system is doing what it’s meant to do – caching your site’s content to make it load faster. Most of the time this can easily be resolved by purging your site’s cache at either the server-level or the browser-level.
How to purge the server-level cache for your website
Server-level cache covers all of the dynamically generated content of your site. This could mean posts, pages, query results, or event assets loading from your CDN. There are two ways to purge these caches at WP Engine.
Option 1. Purge cache through your WordPress Admin Dashboard
This first option is the most exhaustive and, therefore, usually the most preferable.
- First, login to your site (yoursite.com/wp-login.php) and select the WP Engine tab at the top of your left sidebar.
- From this page, click Purge All Caches. This will cover WP Engine’s server-side caching as well as our CDN offering (if you have this feature enabled).
Option 2. Purge cache through your WP Engine User Portal
While the option to “purge all caches” in your WordPress Admin Dashboard is often preferable (since it clears all server-level caching layers and the CDN cache), this is not always the case. Perhaps a caching issue is preventing you from logging into your website, or maybe the User Portal is more convenient at the time.
- Login to your User Portal (my.wpengine.com) and navigate to the Environment for which you wish to purge cache.
- From the Environment’s Overview page, select Utilities from the left-hand navigation. Then scroll to the section labeled Cache options.
- Click Clear cache to clear your website’s page caching layer. Note that this does not clear the Object cache or the CDN cache, if you are utilizing either.
How to purge the browser-level cache for your website
If your changes still are not visible on your site after clearing the server-level cache, you may be encountering caching at the browser level. The default behavior of most browsers is to cache static assets, like CSS and JS files. This behavior can prevent your changes from displaying on your website.
You can clear your browser cache when this happens, but that will only affect your own browser. Other visitors to your site may see the out-of-date content until they clear their own browser cache. To avoid requiring you or your visitors to purge browser cache after updates to CSS and JS files, you can employ versioning for static assets.
By adding a version number to your static files, you can update this number when changes are made. When a browser sees that the version number has changed, it will request a fresh copy of the files from the server. Note: You will still need to purge the server-level page cache using one of the methods listed above, so that the HTML rendered in the browser contains the new version number.
You can add a version number when you enqueue these files through WordPress, as shown in the example below:
wp_enqueue_style( 'custom_style', get_templates_director_uri() . '/style.css', array(), MY_VERSION ); wp_enqueue_script( 'custom_js', get_template_directory_uri() . '/js/main.js', array(), MY_VERSION );
You can add a version number manually by replacing MY_VERSION with a numeric string (ex. “1.0.1”). Another option is to set a variable for MY_VERSION within your wp-config.php file. This way, anytime you update your scripts or styling, you can update the MY_VERSION variable in one place and all functions using that variable will receive the update – rather than having to find each instance you’ve set and update them manually.
If for any reason you’re still not seeing your updated content, just open a Live Chat (available 24/7) with our Support Team from within your User Portal, and we are glad to help out further.