Created
March 11, 2019 05:15
-
-
Save yasircs4/69f17df9b0c16bc614d7ff6aa400c511 to your computer and use it in GitHub Desktop.
Cleaning post type meat_post from wp_postmeta table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @link https://www.smarthomebeginner.com/clean-wp-commentmeta-wp-postmeta/ | |
-- Here too, we first select the postmeta | |
-- where is: post id is equal AND post_type equal 'wp-rest-api-log' | |
SELECT * FROM wp_postmeta pm LEFT | |
JOIN wp_posts wp ON wp.ID = pm.post_id | |
WHERE wp.ID = pm.post_id AND wp.post_type = 'wp-rest-api-log'; | |
-- this get 3013629 | |
-- all wp_postmeta 3023115 | |
DELETE pm FROM wp_postmeta pm LEFT | |
JOIN wp_posts wp ON wp.ID = pm.post_id | |
WHERE wp.ID = pm.post_id AND wp.post_type = 'wp-rest-api-log'; | |
-- 3003810 rows affected. (Query took 80.4992 seconds.) | |
-- before => all wp_postmeta 3023,115 | |
-- After => all wp_postmeta 14,487 | |
DELETE FROM `wp_posts` WHERE `post_type` = 'wp-rest-api-log' | |
-- before => all wp_posts 228,664 | |
-- After => all wp_posts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment