If you need an SQL query, then this option should be suitable
function src_flush_revisions () {
global $wpdb;
$post_id = 5//exp post id
if ( isset( $timeLimit ) ) {
$revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT `ID` FROM $wpdb->posts WHERE `post_type` = 'revision' AND `post_parent` = %d", $post_id ) );
foreach ( $revision_ids as $revision_id ) {
wp_delete_post_revision( $revision_id );
}
}
}
add_action( 'admin_init', 'src_flush_revisions' );
Related Posts:
- Manually removing revision post types
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- Delete all drafts?
- Why my wp_posts data is so huge?
- How Can I Always Display A Particular Post First Using WP_Query?
- Clean up customize_changeset in DB
- Change permalinks in posts via SQL
- How to limit the number of posts that WP_Query gets?
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Should we trust the post globals?
- Can posts have parents?
- Where is the old post permalink slug stored?
- Separate Database Tables For Different Post Types
- Random sort within an already sorted query
- how to get a different html for odd/even posts?
- SQL Query for getting all posts in their latest revised state
- 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?
- How to know if get_posts() failed?
- Any way to create a revision of a post ONLY with a new button in the Meta Box?
- Moving WordPress to new server: no posts found
- Using $wpdb to query posts with meta value containing current post_id
- Query posts from current year
- WordPress Number of Posts Not Changing With posts_per_page
- how to enable different number of revisions for different blogs when using WPMU?
- I have over 4000 posts, will querying some of them cause performance issues?
- Duplicate posts
- Looping through posts per category gives same posts for each category
- How to show posts rank based on custom field value
- Get the author of the latest revision
- How do I create Comma Separated list of attached image ids?
- Custom Taxonomies Incorrectly Counting Revisions?
- How to add posts to wp_query result?
- Trying to put an array into ‘post__in’ => array() query not working
- 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
- Query All users that has post
- Exporting Data from WordPress into a flat table
- wp_enqueue_media() slows down my WP site
- How can I get all posts data from within a paginated search result?
- Insert posts in two tables
- Instead of submiting an entire post, is there any way to submit a lite-post or a simple message?
- Importing New Posts from Live Site into Local Dev Site
- Search query – exact post title match
- Sorting posts alphabetical that have single digits
- Adding a cancel button to edit post screen
- Query posts from different categories in multisite
- How do I batch create revisions of all posts?
- Check if post exists
- posts_per_page doesnt work
- Sorting posts according to view counts not working
- Display page content AFTER a loop of posts
- Are posts updated or built from revisions + autosaves?
- Only display posts after current date
- Get posts by multiple ID’s (query)
- How much of my site can I recover from public_html?
- How to start with post number x?
- Exclude posts with empty post_content in wp_query
- Reset/Reorder posts ID in the MySQL wp_posts table
- Only display a certain number of posts, dependent on how many posts there are available in a query
- How to store an extra (surrogate) ID when creating a post with wp_insert_post?
- Enable post revisions for a specific post
- How do I find which articles are missing a featured image in The WordPress database?
- Improving WP_Query for performance when random posts are ordered
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Split WP_POST table based on post types
- Most recent post from another database
- What structure should post_content have in the database?
- Multiples Empty Posts were created and cannot delete them
- Define a wordpress constant through plugin functions?
- Query how many items to show in shortcode
- Post revisions disappeared (for some posts)
- Get posts by name and taxonomy term
- WP_Query Authors OR Categories
- 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?
- Sticky post appears twice
- do_shortcode within post query
- How Can I Query a Specific Page From a MultiPage paginated Post
- Extracting post categories
- How to modify post content?
- Get Meta Key Value While Saving Post
- Most liked page not displaying posts
- Query get post,how to add comment box
- How to hide html tags on revision comparison pages?
- After database migration, posts not showing up in dashboard
- filter RSS feed in URL
- WordPress custom Query for Posts in Category display posts multiple times
- Transferring WordPress Database – Serialised data
- Emojis replaced by ‘?’ automatically
- get query() without post content?
- WordPress Local And Live Site
- How can I setup a relationship using categories in WordPress?
- Exclude the first ‘n’ number of posts of a tag from home page?