WP Rocket (WordPress-plugin)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

WP Rocket is a plugin for caching & performance.

Download

WP Rocket is a non-free plugin and that has consequences concerning installation, or more specifically: Concerning download.

WP-CLI

You can't install WP Rocket through WP-CLI, probably because it is a proprietary plugin [1].

Once it is installed, you can uninstall, delete, etc. through the WP-CLI. E.g.:

i="wp-rocket"; wp plugin deactivate "$i"; wp plugin delete "$i"

Manual

It seems to work, to copy all files from one installation to another. Since wp-rocket also updated .htaccess files, some additional file wrangling is needed. E.g.:

cd /var/www/example.com/wp-content/plugins
mkdir wp-rocket
cd wp-rocket
copy /var/www/exmple.nl/wp-content/plugins/wp-rocket/* .
cd /var/www/example.com
wp_sr_up.sh
touch .htaccess # only if it doesn't exist!

Versions

There is an issue (WP Rocket & Redirects) with WP Rocket from before 3.13, so let's check recent (2023.11) version history:

  • 3.12 - 2022.12
  • 3.13 - 2023.03
  • 3.14 - 2023.06
  • 3.15 - 2023.08

Installation

After downloading and activating the plugin, the plugin wanted to be able to write in various places. I have script wp_sr_2up for that, and it works fine.

.htaccess

WP Rocket wants to modify .htaccess (in the root of the site). However, this will not work if that file does not yet exist. Error message writing failed? Maybe touch .htaccess is the solution.

advanced-cache.php

During installation, file wp-content/advanced-cache.php is installed. This is a drop-in plugin.

Pause

  • Most practical way to pause caching Wp Rocket: Deactivate the plugin
  • When you click on deactivate, a menu opens that offers an additional approach - Handy!

WP-CLI interface

There is a WP-CLI interface for WP Rocket, that needs to be installed separately: https://docs.wp-rocket.me/article/1497-wp-cli-interface-for-wp-rocket

Deïnstallatie

WP Rocket doet van alles en nogwat. Helaas lijkt dat niet te worden teruggedraaid als je de plugin deactiveerd:

  • Verwijder eerst andere caching-plugins
  • Plugins » WP Rocket » Settings » Clear cache
  • Plugins » WP Rocket » Deactivate
  • Plugins » WP Rocket » Delete
  • Delete file: rm wp-content/advanced-cache.php → Geeft problemen!
  • sudo rm -rf wp-content/cache

Via WP-CLI:

wp plugin deactivate wp-rocket
wp plugin delete wp-rocket

Scheduled Database Optimization failes

Foutmelding: The following scheduled event failed to run. This may indicate the CRON system is not running properly, which can prevent some WP Rocket features from working as intended: Scheduled Database Optimization

Oplossing (in dit geval, feb. 2022):

sudo crontab -e -u www-data

en de bijbehorende regel (invoeren gaat interactief):

*/10 * * * * wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Zie Cron & WordPress voor details.

See also

Sources