Learnpeople-SEO, SEM, Social Media-Helping your light in the world be found! Cincinnati, Dayton Ohio
Previous Post:  

WordPress Optimization of Database MySQL

Hopefully these lines of code will help you shrink your wordpress databases

You must use these by accessing PHPadmin from your control panel

DELETE wp_term_relationships FROM wp_term_relationships
LEFT JOIN wp_posts ON wp_term_relationships.object_id = wp_posts.ID
WHERE wp_posts.ID is NULL;
SELECT * FROM wp_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM wp_comments );
DELETE FROM wp_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM wp_comments );
SELECT * FROM wp_commentmeta WHERE meta_key LIKE ‘%akismet%’;
DELETE FROM wp_commentmeta WHERE meta_key LIKE ‘%akismet%’;
SELECT * FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
DELETE FROM `wp_options` WHERE `option_name` LIKE “_transient_timeout_rss%”;
DELETE FROM `wp_options` WHERE `option_name` LIKE “_transient_rss_%”;
DELETE FROM `wp_options` WHERE `option_name` LIKE “_transient_timeout_feed_%”;
DELETE FROM `wp_options` WHERE `option_name` LIKE “_transient_feed_%”;
DELETE FROM wp_commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM wp_comments);
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE count = 0 );
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);
DELETE from wp_comments WHERE comment_approved = ‘0’;

 

 

MAKE SURE YOU OPTIMIZE YOUR DATABASE AFTER YOU DO THIS!

Posted 2 months, 1 week ago at 3:47 am.

Add a comment

LearnPeople helps organizations with the SEO, SEM, Social Media, Web Hosting and Design and Marketing needs.

LearnPeople.com John Bissman SEO SEM Social Media Marketing Communications 513-836-6023