I suggest you use MySQL “DELETE”. See this article:
http://www.mysqltutorial.org/mysql-delete-join/
So, something like this:
DELETE wp_posts, wp_postmeta
FROM wp_posts
INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
WHERE meta_key = 'expiry date' AND meta_value <= '2017-11-27' AND post_status != 'publish'
NOTE: ‘wp_’ could be different depending what your table prefix is set to in your wp-config.php file.
This should get rid of all posts in the posts table and all of the meta records in the meta table. It will also get rid of drafts/revision.
DOUBLE NOTE: -SUPER IMPORTANT- Don’t do this unless you have a backup of your database.
Related Posts:
- Enable revisions for custom post type
- Add category base to url in custom post type/taxonomy
- Allow member to have access to custom post type only. Permission to only edit their own posts
- WordPress Custom Post Types with a page as a parent?
- add_rewrite_endpoint() not working for custom post type archives
- Custom post type URL with post ID that allows archiving and paging
- How do i display the post type title?
- Sorting a query by custom field date
- Page is defaulting to archive page and not designated template
- WordPress Custom Post Type Category Page
- Removing parent slug from URL on custom post type
- Exclude post_type from admin comments_list
- White screen error for a custom theme
- disable /feed/ for custom post type
- Remove POST_TYPE from custom post type permalink
- Redirect a page based on last word in slug
- Display Post Author for Custom Post Type in Edit-Post Screen
- How to publish custom post type for custom role user and not “submit for review”?
- Custom post types and permalink
- Custom post types, taxonomies, and permalinks
- How to query different post types in specific order?
- How can I display my custom metaboxes on a custom post template?
- “Allow Comments” box cannot be checked
- Second Custom Post Type Archive
- Delete link on single-custom.php with redirection
- WP All Import – Using Xpath to set a select value
- Single Template for Custom Post Type stops working after WordPress 5.4 update
- How to make sure content doesn’t display if selection is empty
- Categories sorting
- Wp_query: sort by PHP variable
- How can I make my custom posts appear in their assigned category url?
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- child of post type (custom)
- Rewrite rules for custom posts types
- How do I create an archive page as a including metadata?
- Add tag to a custom post type doesn’t change the total of custom post type in backend
- How to create custom post by using REST API securely?
- Index page with the same id as the slug
- How to display error message in password protected form using ajax jQuery?
- How to Create Columns with WordPress and CPTUI display page ?
- Custom post listing page layout of custom post type
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- WordPress make Grandparent and great grandparent filterable in custom columns
- How to organize hierarchical structure in custom post type with taxonomy (like with categories)
- Order posts by 2 custom fields and if one custom field is zero orderby another custom field
- Reworking function for counting custom post type posts count
- Best way to specify “article type” in URL
- Archieve.php not loading for custom post type
- Page listing Custom Posts
- Where is the sticky post option?
- show all custom posts types in home page
- get_posts seems to be skipping the last Post
- Dynamically insert an article at the top of a taxonomy archive – or?
- Need help deciding on a taxonomy
- post_type internal ID?
- Custom page for editing custom post type on frontend based on url
- Sum and count of custom field values
- How to show list of taxonomy terms associated with specific post?
- I have custom post type with custom taxonomy. But not found the taxonomy page..
- Custom Post Type Field Array parsing [closed]
- Display latest posts of author in a custom post type
- Custom post type hierarchical loop in Homepage
- Help on Custom Post Types
- My custom posts that are assigned to categories, are not called on a category search using a Category Menu
- How to use pre_get_posts on archive page custom post type
- Give active class to current page on a while loop WP query for custom post types listing
- Archive per year of a custom post getting the wrong post
- Alike Shortcode using in Custom Shortcode
- Remove custom permalink base from CPT custom category and custom tags
- Custom Metabox Info Not Saving
- ACF Pro Accessing fields on a Custom Post Type
- add_rewrite_rule wordpress ignoring url pattern, wp rewrite not working
- How do I change the visible tables in the CPT dashboard?
- Is there a best practice, or typical way to do AJAX updating for data on a custom admin screen or post.php?
- I can not call the categories of custom post type
- Filter a custom taxonomy from displaying a button all other taxonomies can show
- Order by post meta value gets random results
- Metabox is not saving
- WPML – Auto Duplicate Post Issue
- Loop carousel slider in wordpress
- Custom post type – two taxonomies
- Order Custom Posts by Several Fields
- How do display gallery embedded to the custom post type
- Trying to access custom post redirects to home page
- Best way to structure article and issue relationship for CPT
- How to change the default orderby from “Date” to e.g. “Title” or my custom column in content type records list in admin?
- Custom post types working in functions.php but not in plugin
- Custom Post Type Permalinks with %category%
- Pagination not working with custom loop
- How to make an admin create/edit post page to look like taxonomy page?
- Looping taxonomy in taxonomy?
- Archive Page Pagination not working
- Missing categories for Custom Taxonomy and Custom Posts
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- admin search of pages returns custom post types
- Show one of the taxonomies always as default
- Trying to set up a range filter for related custom post types
- From form submission values – dynamically update CPT “has_archive” slug and custom taxonomy “rewrite” slug value
- Multiple posts selection [closed]
- How to make a non-public post on wordpress approval?