- This topic has 0 replies, 1 voice, and was last updated 5 months, 3 weeks ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- You must be logged in to reply to this topic.
Welcome › mkmcst community Forum › Web programming › WordPress › Random wordpress › Limit WordPress Post Revisions
// Define your custom function
function limit_post_revisions($num, $post) {
// Set a max limit for revisions for all post types
$max_revisions = 5;
// Check if the post type is 'post'
if ($post->post_type == 'post') {
return $max_revisions;
} else {
return $num;
}
}
// Hook into the 'wp_revisions_to_keep' filter
add_filter('wp_revisions_to_keep', 'limit_post_revisions', 10, 2);