Per Post Type Revision Numbers

Remove the action ‘wp_save_post_revision’ from ‘pre_post_update’. It is set per default in wp-includes/default-filters.php with the default priority (10). Add your own function to this hook. You get the $post_ID as parameter, so detecting the post type is easy. In your callback copy the code from wp_save_post_revision() but use the constant WP_POST_REVISIONS for the post type … Read more

How do i know the current post type when on post.php in admin?

add_action( ‘admin_init’, ‘do_something_152677’ ); function do_something_152677 () { // Global object containing current admin page global $pagenow; // If current page is post.php and post isset than query for its post type // if the post type is ‘event’ do something if ( ‘post.php’ === $pagenow && isset($_GET[‘post’]) && ‘post’ === get_post_type( $_GET[‘post’] ) ) … Read more