draft
is not a post_type
, it’s a post_status
. So you should use your second block of code with that substitution:
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)
WHERE a.post_status="draft"
Related Posts:
- Delete post revisions only for a single post
- How Can I Always Display A Particular Post First Using WP_Query?
- Change permalinks in posts via SQL
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- How can I safely increase the character limit for post passwords?
- How to Group Posts by the First Letter or Number?
- Restore contents of deleted user
- How are terms connected with posts in database?
- Using $wpdb to query posts with meta value containing current post_id
- Query posts from current year
- I have over 4000 posts, will querying some of them cause performance issues?
- Custom Taxonomies Incorrectly Counting Revisions?
- How to add posts to wp_query result?
- Order post by year DESC and month ASC
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- How can I display a specific user’s first published post?
- database columns: post_title vs post_name
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- wp_enqueue_media() slows down my WP site
- Importing New Posts from Live Site into Local Dev Site
- Sorting posts alphabetical that have single digits
- Query posts from different categories in multisite
- posts_per_page doesnt work
- Sorting posts according to view counts not working
- Manually removing revision post types
- How much of my site can I recover from public_html?
- Improving WP_Query for performance when random posts are ordered
- Multiples Empty Posts were created and cannot delete them
- Get posts by name and taxonomy term
- Get Posts that are in the current month or later
- How to delete all the content of a wordpress site without deleting the Post and pages?
- do_shortcode within post query
- Extracting post categories
- Get Meta Key Value While Saving Post
- Most liked page not displaying posts
- Query get post,how to add comment box
- How can I setup a relationship using categories in WordPress?
- Can’t update old posts 3.5.2
- Copy post to separate database with “add_action(….)”
- How i can limit period of post publication?
- When open add new post or page WordPress add post with ID=0 continuously [closed]
- Anyone know why wordpress converts some html entities to their numeric equivalents?
- How to setup a query to output posts by groups of five?
- What do these phpMyAdmin errors mean on my WordPress databaes?
- Exclude current custom post on single post
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- First x post with another template then the others
- Why Query is returning empty array?
- Wrap every month posts in div
- Why my wp_posts data is so huge?
- Why posts array is empty?
- Move posts from a non-wordpress site to wordpress
- wp_posts table extremely large
- Display post by click on the link
- Queries take 120+ seconds on my large WordPress site
- Related Posts function not working
- WordPress loop not working on static front page
- How to display only one category in a custom post type?
- why the posts queried from sql is more than those showed on the page?
- Export all posts to import as product items
- Anyone know a php snippet for showing the first 200 characters of the most recent post?
- Get current taxonomy and display query accordingly
- Is there a function to get post info for any publish_status by post ID?
- Prevent duplicate pages from being added
- Show 10 latest posts only from users with contributors role
- Your ideas on my though “delete or move all of the posts in a specific category when 3 days are passed”
- How can I globally italicize list of texts in the UI database or Posts? [closed]
- Return records between two meta datetimes saved as strings
- Check if almost 10 year old – working code is up to date
- My website is showing today’s date instead of published date since db migration to a new wordpress
- Query custom post type custom meta key
- Bulk find & replace on WordPress posts/pages (minus image paths)
- How can I stop ‘in use’ message from intermittently blocking my wp_posts table?
- filter posts based on menu_order
- Count posts for pagination
- I need some explanation on global $post [duplicate]
- how i show manual data in a post
- Clean up customize_changeset in DB
- How to delete all posts with dead image urls?
- Querying posts from current category, using a variable as array argument
- How do I get a certain set of posts from the database?
- Maximum number of posts per page before affecting performance?
- Surrogate ID for posts, is there an alternative field in the posts table?
- wp query custom orderby not custom field
- Query post by meta key of another table
- Expired Post with More Recent Time Stamp?
- Query post category & remove any post id
- Converting Posts to Pages
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- How to change the publishing date of each posts?
- Removing a post from the results of a WP Query
- Extra field in wp_post instead of postmeta
- Voting System, database connections?
- Query posts from a specific category and selected tag
- Creating pages and getting their values from the database table
- How to limit post query to only return a total count of items with certain post statuses?
- Load posts from external source if not found in database
- The page that displays Posts on homepage
- query_post or single-[cpt].php?
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields