Assets Addon

PLEASE NOTE: The Assets addon does not work with WP Offload Media 2.0 or later, please use the Assets Pull addon instead.

With the Assets addon you can start serving your site’s assets (CSS, JS, images, fonts, etc) from S3, CloudFront, or another CDN in just a few clicks. It will intelligently scan WordPress core, your theme, and your plugin folders for assets, upload them to S3, and rewrite URLs so they are served from S3, CloudFront, or another CDN according to your settings.

YouTube cover image


Scanning & Uploading

Once you select a bucket to store your assets in, you will need to enable the addon to kick off the scan of your files which will then be uploaded.

Scanning can happen automatically using a WordPress Cron job or you can manually initiate the scan with the ‘Scan Now’ button from within the plugin settings screen. Automatic scanning happens on the following schedule:

  • Core Files – every 30 minutes
  • MU Plugins – every 15 minutes
  • Plugins – every 5 minutes
  • Themes – every 5 minutes

A scan will also take place when you switch themes, update WordPress or activate new plugins.

Serving S3 URLs

Once the files have been uploaded to S3 the addon will start serving any enqueued CSS and JS files from there. WordPress uses the enqueue system to register CSS and JS files and then output <script> or <style> tags for each file on the front end of a site. Plugins and themes should also be using the same system.

Whilst we scan and upload files with a variety of extensions, we only replace URLs with the S3 ones for enqueued CSS and JS files. Therefore your S3 bucket may contain lots of files but you will only see a notice in the addon concerning a small amount of files:

Enqueue notice

Modified Files

WP Offload Media by default automatically scans your assets for changes on a 5 minute cycle. When a modified file is detected, the entire plugin/theme/core directory where the file resides is uploaded to S3 and the old version removed.

All uploaded files have a timestamp appended to their path (object versioning) so that modified files are uploaded to a different location. This ensures that outdated cached content is never served and eliminates the need for cache invalidation when using CloudFront or another CDN.

You can also use the ‘Purge’ button at anytime to remove all assets from S3. This will result in your files being served locally from your server. If you wish to re-upload your assets you can hit the ‘Scan Now’ button or wait for the automatic scanning to occur. This will begin the process of re-uploading all assets to S3.

Caching Plugins

If you are using a caching plugin such as W3 Total Cache or WP Rocket, it is important to turn off their CDN options as they will conflict with the Assets addon.