If you wordpress is slow - try any of the following to clean your databases and optimize your website.

Note if your wp_options table becomes large overtime it can slow down your website considerably as some plugins like woocommerce may leave "transients" and create unnecessary data just lying around slowing down your site unnecessarily.

To speed up your site open up PHPmyAdmin in your cPanel or Plesk interface. Click on your database name if not already selected and run the some if not all of the queries below. Please check the query if its ok for your site some custom setups it may not work for.

  1. Delete Unused Tags

It’s easy for tags to accumulate over time, especially if you add them to posts and then change your mind and delete them. Also, tags have fallen out of favour in recent years as many bloggers have stopped using them. This query will delete all tags that aren’t associated with any posts.

DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE count = 0 );

DELETE FROM wp_term_taxonomy WHERE term_id not IN (SELECT term_id FROM wp_terms);

DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);

 

2. Delete Post Revisions

Old post revisions quickly add up, especially if you have authors on your site who are constantly saving their work over many days. If you want to delete all of the post revisions in your database in on hit, run this query:

 

DELETE a,b,c

 FROM wp_posts a

 LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id)

 LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )

 LEFT JOIN wp_term_taxonomy d ON ( b.term_taxonomy_id = d.term_taxonomy_id)

 WHERE a.post_type = 'revision'

 AND d.taxonomy != 'link_category';

 

3. Delete Transients from wp_options table

 

 DELETE FROM `wp_options` WHERE `option_name` LIKE ('_transient_%');

DELETE FROM `wp_options` WHERE `option_name` LIKE ('_site_transient_%');

Ця відповідь Вам допомогла? 0 Користувачі, які знайшли це корисним (0 Голосів)