Skip to content

Instantly share code, notes, and snippets.

@EngKhaledB
Last active March 1, 2023 17:42
Show Gist options
  • Save EngKhaledB/d49cb042c8d320d6f8b6c2433da94b77 to your computer and use it in GitHub Desktop.
Save EngKhaledB/d49cb042c8d320d6f8b6c2433da94b77 to your computer and use it in GitHub Desktop.

Setting Up WP-Rocket on Pantheon

1- Install WP-Rocket

Install WP-Rocket regulary, do not activate.

2- Create caching folders

via your pantheon Dashboard, go to the envrionment then Connection Info and copy the login command line to SFTP. Login to SFTP, then create these 2 folders under Uploads

  • cd /code/wp-content/uploads
  • mkdir cache
  • mkdir wp-rocket-config

2- Create symbolic links

Now, the challanging part I had, was to create symbolic links on windows, and add these links to git.

For Windows in your project root (WordPress root)

  • cd wp-content/
  • mkdir uploads\cache
  • mkdir uploads\wp-rocket-config
  • mklink /d .\cache .\uploads\cache
  • mklink /d .\wp-rocket-config .\uploads\wp-rocket-config

For Linux/Mac

  • cd wp-content/
  • mkdir uploads/cache
  • mkdir uploads/wp-rocket-config
  • ln -s ./uploads/cache ./cache
  • ln -s ./uploads/wp-rocket-config ./wp-rocket-config

3- Disable WP-Rocket page caching to keep using Pantheon advanced caching

On wp-config.php define( 'WP_CACHE', false );

On functions.php (or your plugin)

add_filter( 'do_rocket_generate_caching_files', '__return_false', PHP_INT_MAX );
add_filter( 'rocket_set_wp_cache_constant', '__return_false', PHP_INT_MAX );
add_filter( 'rocket_generate_advanced_cache_file', '__return_false', PHP_INT_MAX );

3- Add files to Git and push to Pantheon.

4- Enable WP-Rocket and congfigure it!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment