phpMyAdmin is the most common way to manage a WordPress database. It is important to backup and save a copy of your .sql database file before you proceed with any of these commands.
Even after you have removed a plugin, there is data still left inside the post_meta table which is no longer needed. Run the following query to clean this up.
To use phpMyAdmin follow the steps below:
- Login to phpMyAdmin panel and select your WordPress database.
- Click on the SQL tab which will bring you to a page with a SQL query box.
DELETE
FROM wp_posts
WHERE post_type = 'revision';
Spam comments can also be deleted using the following SQL command.DELETE FROM wp_comments WHERE comment_approved = 'spam'>
All comments awaiting approval can be deleted by using the following SQL command.DELETE FROM wp_comments WHERE comment_approved = '0'
Even after you have removed a plugin, there is data still left inside the post_meta table which is no longer needed. Run the following query to clean this up.
delete from="" wp_postmeta="" where="" meta_key="your-meta-key" ;
After many edits to a post or page, the amount of stored revision can really start to add up. Use this command to delete all revisions.
DELETE FROM wp_posts WHERE post_type = 'revision';
To change the URL or domain name used for your WordPress site in 2 easy commands. Login into phpmyadmin and click on the "sql' tab at the top menu.
- Paste the below command changing the domains with your domains. This will update all media and post links.
UPDATE wp_posts SET post_content = REPLACE ( post_content, 'old domain URL here', 'new domain URL here');
- Paste the below command changing the domains with your domains. This will update main site url and homepage url.
UPDATE wp_options SET option_value = 'new domain URL here' WHERE option_value = 'old domain URL here'