backup your database before doing anything otherwise!
you can stimulate query to check in phpMyAdmin
note this query only delete post not pages.
SQL query:
Matched rows: 3983
3983 rows affected. (Query took 0.3078 seconds.)
DELETE FROM `2xpwp_posts` WHERE post_type=’post’;
after
delete pages or posts where filter by category
2nd use bulk delete plugin.
delelte all posts and pages in database
you can emtry the wp_posts tables in phpmyadmin
delete all pages except this parent page
DELETE FROM `2xpwp_posts` WHERE post_parent !=”admit-card”;
DELETE FROM `2xpwp_posts` WHERE post_parent !=”91″;
min/post.php?post=91&action=edit
111551 rows affected. (Query took 9.5802 seconds.)
DELETE FROM `2xpwp_posts` WHERE post_parent !=”91″;
404 errors after running above query
page attributes parent page missing
convert all pages to Posts WordPress mysql
UPDATE `2xpwp_posts` SET post_type=’post’ where post_type=’page’;
clean up wordpress options
2036789
Delete Orphaned Post Meta Data in WordPress
— List all orphan rows from wp_postmeta
SELECT * FROM wp_postmeta
LEFT JOIN wp_posts ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_posts.ID IS NULL;
— Delete all orphan rows from wp_postmeta
DELETE wp_postmeta FROM wp_postmeta
LEFT JOIN wp_posts ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_posts.ID IS NULL;
[/sql]
1065582 rows affected. (Query took 56.2079 seconds.)
DELETE 2xpwp_postmeta FROM 2xpwp_postmeta LEFT JOIN 2xpwp_posts ON 2xpwp_posts.ID = 2xpwp_postmeta.post_id WHERE 2xpwp_posts.ID IS NULL;
delete all categories except 1 category wordpress mysql
Deleting All tags except categories Wp database
delete from `wp_terms` where `term_id` in ( SELECT `term_id`
FROM `wp_term_taxonomy`
WHERE `taxonomy` = ‘post_tag’ ) and `term_id` not like 1
delete all WordPress posts on any category
- DELETE wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON ( wp_term_relationships.object_id = wp_posts.ID ) WHERE wp_term_relationships.term_taxonomy_id = category_id