Disable revisions for a specific post type only? olatechproMarch 5, 20235 Views Any way to disable post revision on specific post types only? Post Views: 5 Related postsGet rid of this Strict Standards warningWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressForce HTTPS using .htaccess – stuck in redirect loopWordPress: Ajax not working to insert, query and result dataHow Can I pass an image file to wp_handle_upload?
Remove the revisions property inside the supports parameter of register_post_type(). Example $args = array( // ... 'supports' => array('title','editor','thumbnail','comments','revisions') ); register_post_type('book',$args); Change to: $args = array( // ... 'supports' => array('title','editor','thumbnail','comments') ); register_post_type('book',$args); Log in to Reply
If you don’t have control over the post type registration, you an use the remove_post_type_support() function: add_action('admin_init', 'disablew_revisions'); function disable_revisions(){ remove_post_type_support('post', 'revisions'); } If you also wish to disable autosave for specific post types, you can do this: add_action('admin_print_scripts', 'disable_autosave'); function disable_autosave(){ global $post; if(get_post_type($post->ID) === 'post'){ wp_deregister_script('autosave'); } } Log in to Reply
Remove the
revisions
property inside thesupports
parameter ofregister_post_type()
.Example
Change to:
If you don’t have control over the post type registration, you an use the remove_post_type_support() function:
If you also wish to disable autosave for specific post types, you can do this: