WordPress utilizes Transients to manage the cache. If you are experiencing issues with cached pages or a plugin’s functionality, deleting the transients (stored in the database for the website) may resolve the issue. In this guide, you will learn how to delete transients, using the WordPress Command Line Interface (WP-CLI).
Delete Expired Transients Using WP-CLI
WARNING: Before making modifications to your website’s database, we strongly recommend that you create a backup of your database.
SSH into your server as the cPanel user that owns the website you would like to delete expired transients for.
Use the cd command to switch to the document root directory of your website.
Example: cd public_html/my_website
NOTE: Be sure to replace public_html/my_website with the actual path to the document root directory of your website.Run the following command:
wp transient delete-expired
The following output will be displayed once the command finishes running:
[email protected] [~/public_html]# wp transient delete-expired Success: 32 expired transients deleted from the database.
Delete All Transients Using WP-CLI
WARNING: Before making modifications to your website’s database, we strongly recommend that you create a backup of your database.
SSH into your server as the cPanel user that owns the website you would like to delete all transients for.
Use the cd command to switch to the document root directory of your website.
Example: cd public_html/my_website
NOTE: Be sure to replace public_html/my_website with the actual path to the document root directory of your website.Run the following command:
wp transient delete-all
The following output will be displayed once the command finishes running:
[email protected] [~/public_html]# wp transient delete-all Success: 38 transients deleted from the database.
Congratulations! Now you know how to troubleshoot caching issues by deleting expired WordPress transients in the database.
Learn more about WP-CLI, the command-line interface for WordPress, and streamline your WordPress maintenance workflow!
Comments
It looks like this article doesn't have any comments yet - you can be the first. If you have any comments or questions, start the conversation!