Technical Configurations
Technical guides, info, and code examples.
How to clear cache via cron job
WP Rocket provides custom functions for clearing and preloading the cache. In order to run these at specific times each day, you can use a cron job on your server.In this Article Set Up a Cron Job Clear and Preload…
How to make a custom (MU) plugin
The difference between a regular plugin and a MU (“ must use”) plugin in WordPress is: MU plugins are activated automatically once uploaded to a specific folder in WordPress.In this Article Making a custom MU plugin Things to consider Example…
How to programmatically clear the cache and optimizations
This article shows how can the cache and optimizations be purged programmatically, to extend or customize the default behavior of WP Rocket, and some examples of usage for each. Heads up! This guide assumes comfort with editing PHP code. If…
How to programmatically configure WP Rocket’s options
Heads up! This guide assumes comfort with editing PHP code. If that's not you, please ask your developer to implement it for you. There are currently 2 possible ways to automate the configuration of WP Rocket: Using the WP Rocket…
How to provide WP Rocket support with access to your site?
This article explains why WP Rocket's support team may need credentials of a website to troubleshoot some specific problems, which type of credentials are required, and how to share them safely.In this Article Why is access sometimes needed? Which credentials…
Increase PHP memory limit in WordPress
Sometimes when you are trying to perform a normal WordPress action like activating a plugin, you get an error message like this: Fatal error: Allowed memory size of 157286400 bytes exhausted (tried to allocate 5775295 bytes) If you are running…
Multiple configuration files for WP Rocket
WP Rocket writes an important PHP configuration file inside /wp-content/wp-rocket-config/your-website.com.php. The filename is created following the same domain you are using on your WordPress configuration. For example: if your site is called www.ThePerformanceSite.com, the file will be named: www.theperformancesite.com.php The same goes…
Programmatically toggle WP Rocket options under specific conditions
If you need to programmatically deactivate or activate one of WP Rocket's options, you can use our pre_get_rocket_option_{option_name} filters. This can be particularly useful in some cases. Imagine that you need to deactivate the Delay JavaScript Execution in 100 Product…
Redirect HTTP to HTTPS
If you have SSL enabled for your entire site, you will need to make sure that all links pointing to the HTTP version of your site will be automatically redirected to the HTTPS version. You may use one of the…