If changes to your website aren’t showing, or pages suddenly show a 404 Not Found error, clearing caches or rebuilding your permalinks usually fixes it.
Clear the WordPress cache
wp cache flush
This clears WordPress’s object cache, including Redis if your website uses it.
Clear temporary data (transients)
Plugins store temporary data in your database, which can sometimes get stuck:
wp transient delete --all
Clear your caching plugin
Caching plugins keep their own copies of your pages, and many add their own WP-CLI commands. For example, if you use LiteSpeed Cache:
wp litespeed-purge all
For other caching plugins, check the plugin’s documentation, or clear the cache from its settings page in WordPress.
Fix pages showing a 404 error
If your home page works but other pages show a 404 error, your permalinks (WordPress’s rules for page addresses) may need rebuilding:
wp rewrite flush
Check your current permalink setting with:
wp option get permalink_structure