### WP Rocket CLI Usage Examples Source: https://docs.wp-rocket.me/article/1497-wp-cli-interface-for-wp-rocket Practical examples demonstrating how to use WP Rocket CLI commands. ```APIDOC ## Usage examples # Using your terminal navigate in the root folder of your WordPress installation, and type the command that corresponds to the action you’d like to be performed. **Clear the whole cache** ` wp rocket clean ` At the prompt, type `y` to confirm cache clearing. If you want to clear the cache without confirmation, append the `--confirm` flag. ` wp rocket clean --confirm` Note that this command will not clear the cache for Varnish. **Export WP Rocket settings** ` wp rocket export ` **Import WP Rocket settings** ` wp rocket import --file=wp-rocket-settings-2021-03-15-604ed873558a0.json` Alternatively, the settings file can be imported from a URL: ` wp rocket import --file=https://example.com/wp-rocket-settings.json ` ``` -------------------------------- ### Install Composer Dependencies Source: https://docs.wp-rocket.me/article/1301-wp-rocket-installation-from-github-using-composer Navigate to the WP Rocket plugin directory and run this command to install necessary third-party libraries via Composer. The --no-dev and --no-scripts flags optimize the installation for production. ```bash composer install --no-dev --no-scripts ``` -------------------------------- ### WP Rocket CLI Installation Source: https://docs.wp-rocket.me/article/1497-wp-cli-interface-for-wp-rocket Instructions for installing the WP Rocket CLI using WP-CLI. ```APIDOC ## WP Rocket CLI Installation **WP-CLI v0.23.0 or later** In the command line enter the following: `wp package install wp-media/wp-rocket-cli:trunk` If all goes well, you’ll see this: **WP-CLI prior to v0.23.0 - Manual installation** 1. Download the package from here: https://github.com/wp-media/wp-rocket-cli/archive/trunk.zip 2. Upload the file to your server. 3. Using the command line, navigate to the folder you uploaded the file in step 1. 4. Run the following command: ` wp package install wp-rocket-cli-trunk.zip ` ``` -------------------------------- ### Manual Installation of WP Rocket CLI (Older WP-CLI) Source: https://docs.wp-rocket.me/article/1497-wp-cli-interface-for-wp-rocket Manually install the WP Rocket CLI for WP-CLI versions prior to 0.23.0. This involves downloading, uploading, and then installing the zip file. ```bash wp package install wp-rocket-cli-trunk.zip ``` -------------------------------- ### Example URL with Multiple Ignored Parameters Source: https://docs.wp-rocket.me/article/971-caching-query-strings This example shows a URL with multiple query string parameters, all of which are on the ignored list. The page will be cached. ```text example.com/page/?utm_source=this&utm_campaign=that&utm_medium=theother ``` -------------------------------- ### Example URL with Multiple Query String Parameters Source: https://docs.wp-rocket.me/article/971-caching-query-strings This example shows a URL with multiple query string parameters. If 'country' is a cached parameter, this URL will be cached. ```text example.com/page/?country=italy&wine=red ``` -------------------------------- ### Example Dynamic Filename Source: https://docs.wp-rocket.me/article/132-excluding-dynamic-filenames This is an example of a dynamically changing filename for a CSS file, where the numeric part varies. ```text style-12345678.css ``` -------------------------------- ### Original CSS link example Source: https://docs.wp-rocket.me/article/1266-optimize-css-delivery This is an example of a standard CSS link before WP Rocket's Load CSS Asynchronously modifies it. ```html ``` -------------------------------- ### Install ngx_brotli module on Debian and Ubuntu Source: https://docs.wp-rocket.me/article/1403-enable-text-compression Installs the nginx-plus-module-brotli package using apt-get. This is for Debian-based systems. ```bash $ apt-get install nginx-plus-module-brotli ``` -------------------------------- ### Example URL with Query Parameter Source: https://docs.wp-rocket.me/article/1131-resolving-issues-with-css-minify-combine Append `?nowprocket` to a URL to bypass WP Rocket and inspect CSS files. ```text example.com/about?nowprocket ``` -------------------------------- ### Another Dynamic Filename Example Source: https://docs.wp-rocket.me/article/132-excluding-dynamic-filenames This demonstrates a different dynamic filename structure, including a version query parameter. ```text media-07f3e342a4.css?v=2.3.5 custom-07f3e342a4.css?v=2.3.5 main-07f3e342a4.css?v=2.3.5 ``` -------------------------------- ### Example Cron Log Output Source: https://docs.wp-rocket.me/article/1811-how-to-check-if-cron-is-running-correctly This is an example of what the 'cron.log' file might look like, showing different types of cron triggers and their timestamps. Consistent 5-minute intervals indicate correct operation. ```log [2022-11-15 20:00:00] Cron: Triggered by the server [2022-11-15 20:01:00] Cron: WordPress/6.0.2; https://example.com/ [2022-11-15 20:02:00] Cron: WordPress/6.0.2; https://example.com/ [2022-11-15 20:05:00] Cron: Triggered by the server [2022-11-15 20:06:00] Cron: WordPress/6.0.2; https://example.com/ [2022-11-15 20:07:00] Cron: WordPress/6.0.2; https://example.com/ [2022-11-15 20:10:00] Cron: Wget/1.14 (linux-gnu) [2022-11-15 20:13:32] Cron: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) [2022-11-15 20:15:00] Cron: Triggered by the server [2022-11-15 20:16:00] Cron: WordPress/6.0.2; https://example.com/ [2022-11-15 20:17:00] Cron: WordPress/6.0.2; https://example.com/ [2022-11-15 20:20:00] Cron: Triggered by the server ``` -------------------------------- ### Uncached Page URL Example Source: https://docs.wp-rocket.me/article/1104-excluding-inline-js-from-combine This is an example of a URL used to load an uncached, unminified version of a page. Appending '?nowprocket' to the URL is necessary for finding original file URLs during troubleshooting. ```url https://example.com/?nowprocket ``` ```url https://example.com/some-page/?nowprocket ``` -------------------------------- ### Example URL with Query String Source: https://docs.wp-rocket.me/article/971-caching-query-strings This is an example of a URL containing a query string, which WP Rocket does not cache by default. ```text example.com/page/?country=italy ``` -------------------------------- ### Dedicated Caching Example Source: https://docs.wp-rocket.me/article/971-caching-query-strings This example illustrates how WP Rocket creates separate cache files for different values of a 'lang' query string parameter. ```text example.com/about-us/?lang=english example.com/about-us/?lang=french // will create a dedicated cache file for their parameter/value pairs: ?lang=english ?lang=french ``` -------------------------------- ### Install ngx_brotli module on SLES 15 Source: https://docs.wp-rocket.me/article/1403-enable-text-compression Installs the nginx-plus-module-brotli package using zypper. This is for SUSE Linux Enterprise Server. ```bash $ zypper install nginx-plus-module-brotli ``` -------------------------------- ### Example: Custom Redirection Rule Source: https://docs.wp-rocket.me/article/614-adding-custom-rules-to-the-htaccess-file An example of a custom redirection rule that can be added to the helper plugin. This shows how to redirect an old URL to a new one. ```apache Redirect 301 /old-url.html https://yourdomain.com/new-url.html ``` -------------------------------- ### Compatible YouTube iframe Markup Example Source: https://docs.wp-rocket.me/article/1488-how-to-check-if-replace-youtube-iframe-with-preview-image-feature-is-working This is an example of the HTML markup WP Rocket looks for to apply the Replace YouTube iframe with preview image feature. It must contain an iframe with a YouTube URL in the 'src' attribute. ```html ``` -------------------------------- ### Install ngx_brotli module on Amazon Linux, CentOS, Oracle Linux, RHEL Source: https://docs.wp-rocket.me/article/1403-enable-text-compression Installs the nginx-plus-module-brotli package using yum. This is for systems using the YUM package manager. ```bash $ yum install nginx-plus-module-brotli ``` -------------------------------- ### Troubleshooting WP-CLI Memory Issues Source: https://docs.wp-rocket.me/article/1497-wp-cli-interface-for-wp-rocket Guidance on resolving memory limit errors during WP Rocket CLI installation. ```APIDOC ## Troubleshooting # **WP-CLI ran out of memory** If you come across memory issues during installation you can either change the `memory_limit` in the `php.ini` or do the change "on the fly": ` php -d memory_limit=512M "$(which wp)" package install wp-media/wp-rocket-cli ` **Reference:** https://make.wordpress.org/cli/handbook/guides/common-issues/#php-fatal-error-allowed-memory-size-of-999999-bytes-exhausted-tried-to-allocate-99-bytes ``` -------------------------------- ### HTML Before Compression Source: https://docs.wp-rocket.me/article/1403-enable-text-compression This is an example of an HTML file before any compression is applied. It shows the original character count. ```html