1. Home
  2. Enhance Panel
  3. WordPress Command Line
  4. How to clear WordPress caches and fix permalinks with WP-CLI

How to clear WordPress caches and fix permalinks with WP-CLI

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.

New to WP-CLI? Start with getting started with WP-CLI, which shows you how to connect and get to your website’s folder.

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

Still seeing an old version of a page? Your browser keeps its own copy too. Try a private or incognito window, or clear your browser’s cache.

Need a hand? Please contact our support team. We look after your hosting and WP-CLI; problems inside WordPress plugins and themes are covered in do you support WordPress plugins and themes.

Updated on October 1, 2026
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
GET SOME HELP!