Last active
August 28, 2019 12:25
-
-
Save yanknudtskov/904ffa37596f1aeca1a9534387822e03 to your computer and use it in GitHub Desktop.
Cleaning out WordPress Database in relation to very large comments table
This file contains 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
DELETE FROM wp_postmeta | |
WHERE post_id IN ( | |
SELECT ID from wp_posts WHERE post_title = 'sfn_followup_emails' | |
); | |
DELETE FROM wp_posts WHERE post_title = 'sfn_followup_emails'; | |
DELETE FROM wp_postmeta | |
WHERE post_id IN ( | |
SELECT ID from wp_posts WHERE post_title = 'wcs_report_update_cache' and post_status != 'pending' | |
); | |
DELETE FROM wp_posts WHERE post_title = 'wcs_report_update_cache' and post_status != 'pending'; | |
DELETE FROM wp_postmeta | |
WHERE post_id IN ( | |
SELECT ID from wp_posts WHERE post_title = 'wcs_report_update_cache' and post_status != 'pending' | |
); | |
DELETE FROM wp_posts WHERE post_title = 'wcs_report_update_cache' and post_status != 'pending'; | |
DELETE FROM wp_postmeta | |
WHERE post_id IN ( | |
SELECT ID from wp_posts WHERE post_title = 'woo_sc_generate_coupon_csv' and post_status != 'pending' | |
); | |
DELETE FROM wp_posts WHERE post_title = 'woo_sc_generate_coupon_csv' and post_status != 'pending'; | |
DELETE FROM wp_postmeta | |
WHERE post_id IN ( | |
SELECT ID from wp_posts WHERE post_title = 'woo_sc_import_coupons_from_csv' and post_status != 'pending' | |
); | |
DELETE FROM wp_posts WHERE post_title = 'woo_sc_import_coupons_from_csv' and post_status != 'pending'; | |
DELETE FROM wp_postmeta | |
WHERE post_id IN ( | |
SELECT ID from wp_posts WHERE post_title = 'sfn_send_usage_report' and post_status != 'pending' | |
); | |
DELETE FROM wp_posts WHERE post_title = 'sfn_send_usage_report' and post_status != 'pending'; | |
DELETE FROM wp_comments | |
WHERE comment_type = 'action_log'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment