Manipulating posts directly in database is rarely good idea, since it skips all the APIs, hooks and so on that normally participate in the process.
You should use get_posts() to retrieve the list and wp_delete_post() for deletion to ensure it is done properly and there are no leftovers.
Related Posts:
- post__in for get_posts with a dynamic array
- Using $wpdb to query posts with meta value containing current post_id
- WP_Query to work with custom view
- Replace Main Query With Custom Query
- get posts and postmetas in assoc array
- How do I batch create revisions of all posts?
- How to do set post permalinks using 6 digit random unique function?
- Using $wpdb to fetch posts with meta data
- Creating a post from data returned from HTML form
- wp_posts table: safely remove unused columns to save database storage
- Why Query is returning empty array?
- meta_value timestamp older than now
- Displaying post excerpt using wpdb query
- Retrieving posts by their date and category
- query for filtering published posts?
- How to save template data into wp_post table (post_content column)
- Top tags with minimum number of posts
- wp_insert_post not inserting post
- I am not getting result from php function that is json encoded
- Save/retrieve form data best practises for theme development
- WP_Query post_tilte search in posts table
- get_the_category listing in hierarchial order
- How to automate featured posts number? [duplicate]
- Getting only the URL of the post thumbnail
- SQL Command for restoring trashed comments
- Linking to pages/posts within the site
- Displaying posts that belong to a specific author
- Loop don’t work within single.php page
- Importing posts only – consequences?
- Add Post As a menu Item
- WordPress.com post editor replacement
- WordPress Menu options in the Admin: Posts for the dropdowns
- What is $post->pre_post_content exactly?
- Navigate through the posts using keyboard arrows
- unique post in “$args” of wp_query display more than one post
- New Posts and Pages Won’t Save
- Why excerpt is Displaying same in Random Posts list
- How can I add 2 buttons with shortcode
- Show posts on front page only
- inserting a category into post
- Limiting the amount of posts retrieved by the loop
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- Insert specific information to a posts of a predefined category
- Problem with quotes
- How can I get posts from 9/13/11 to today with SQL? [closed]
- Direct some posts to only appear on a specific page
- Anyone know a php snippet for showing the first 200 characters of the most recent post?
- How To import post If I have only subscriber access
- Get post publishing date from within custom HTML block
- Adding Text after Post Title based on Category using IF Condition – But not for menu items
- Display default matabox of posts(add category) wordpress
- Updates are not showing to public (New Posts , Theme Change)
- How to bulk Update URLs to new values?
- How to get tags when using publish_post
- How can I make a post sub link?
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- Display image gallery if more than 1 image
- How do you change the permalink for posts for a single category?
- post thumbnails error
- Disaply products from category
- Excluding category from post navigation in WordPress?
- Add another feature image box
- Post not showing in the front page
- how i show manual data in a post
- Change archive results based on GET request
- Let Contributors Review only (Not Publish) Others Posts
- How to get meta data from custom category name
- Querying posts from current category, using a variable as array argument
- How to show view all posts from front page?
- Ajax the create and edit post form into lightbox and get results
- Wp_query loop is not working as it should
- Blank page after changing number of post displayed in wp-admin
- Precedence of page permalinks over woocommerce product category links?
- Is there a global page/post/product/anything ID?
- How to create a Top 10 Popular Posts Page?
- Related posts not working in the index
- Add category selection to function request
- Multiple Post Repeat for Related Post Loop by Category
- Correcting the content width when sidebar is inactive?
- How to show only Post titles on category pages
- Show Post number of specific Category
- 2nd post different layout
- Print all content of a paged post
- 404 error on every post and page other than home
- Successive creation of over 1000 posts causes 404?
- Show last post of employee in his profile page
- Category pages vs single post pages
- How to limit post query to only return a total count of items with certain post statuses?
- Redirect posts to sub domain except pages
- How to disable edit post option? [closed]
- How do we display a certain category type on a page while hiding all others?
- How to display only introtext?
- Action while post is being published
- Do anything on post_status change [duplicate]
- Post page still linked to old site
- Permalink structure for two separate blogs
- Header and Footer options in pages and posts
- Best method for comment section associated with different images?
- Allow users to edit post without logging in