wpcli w3tc - Purge cache from W3 Total Cache plugin using WP-CLI

Purge cache from W3 Total Cache plugin using WP-CLI

Here are some useful commands to clear cache from the terminal with wpcli: cdn_purge purge URLs from CDN and Varnish flush all flushes all cache related to W3TC (Page Cache, OC, DB Cache, Minify, etc.) flush page flushes pages cache only flush posts flushes both pages & posts cache flush database flushes DB cache flush … Read full article →

wp package install - Install a WP-CLI Package

Install a WP-CLI Package

Packages can be installed to add functionality to WP-CLI, for example wp-cli/wp-super-cache-cli package will add functions for managing WP Super Cache plugin from the terminal. Here is a list of My favourite packages from the wp-cli/package-index: billerickson/wp-cli-plugin-install-missing install any plugins that are “active” but not installed binarygary/db-checkpoint create quick db snapshots for development purposes jaywood/jw-wpcli-random-posts … Read full article →

PHP Fatal Error Uncaught Error Call to undefined function exec - WP-CLI Not Working: Call to undefined function exec()

WP-CLI Not Working: Call to undefined function exec()

For some operations such as database export, WP-CLI uses PHP exec() function which is disabled on most shared hosting servers. So if you do wp db export and no file was created, make sure to check your error_log file and if you notice this error: PHP Fatal Error: Uncaught Error: Call to undefined function exec() … Read full article →

WP CLI Tips and Tricks - WP-CLI Tips and Tricks

WP-CLI Tips and Tricks

Here are a few WP-CLI tricks and tips that might be useful: Aliases Use aliases to make commands shorter and easier to remember. You can use the –alias=<alias> flag when defining a command to specify a shorter alias for the command. For example, if you use a command wp my-command: you could define a command … Read full article →

Bulk Delete Millions of WooCommerce Products using WP CLI - 🗑️ Bulk Delete WooCommerce Products with WP CLI

🗑️ Bulk Delete WooCommerce Products with WP CLI

Here are a few useful one-liners that you can use to quickly remove all WooCommerce products from your store. Another approach: PRO TIP:If you are considering deleting items in WooCommerce, please be aware that this action cannot be undone. Once you have deleted an item, it will be permanently gone from your store. Before taking … Read full article →

wpcli autocomplete - Setup tab completions for WP-CLI

Setup tab completions for WP-CLI

Tab completion is a useful time-saving feature of command line interfaces. To enable tab completion for WP-CLI We need to edit the ~/.bash_profile file. Step 1. In your home directory download WP-CLI tab completion file Step 2. Edit your ~/.bash_profile and add the following line: source ~/wp-completion.bash Save and exit. Step 3. Source the profile … Read full article →

create wpcli aliases - Create WP-CLI Aliases

Create WP-CLI Aliases

IF you use the same commands often you can save them as aliases so that you have them always available. For example, the following commands will check if WP core, installed plugins and themes have updates available: You can combine the commands into a one-liner: and you can create an alias for this command: so … Read full article →

Delete unused images in WordPress using WP CLI - Delete unused images in WordPress using WP CLI

Delete unused images in WordPress using WP CLI

This small script uses a for loop to delete one post ID at a time, it will go through the database and list all media files uploaded in the provided data range that are not used inside posts. Change the date range according to your needs.

wp gatsby netlify - WordPress to Gatsby on netlify ☄️

WordPress to Gatsby on netlify ☄️

When migrating from WordPress CMS to another CMS there are a couple of ways to easily export all your posts and media files: In this guide we will be using the WPGraphQL plugin and Netlify to deploy a Gatsby website. Step 1. Fork the gatsbyjs/gatsby-starter-wordpress-blog repo on Github Step 2. Edit the gatsby-config.js file and … Read full article →