Skip to content

Snippet: Adding/Removing Page Settings Metabox From Post Types

add_filter( 'wpex_main_metaboxes_post_types', function( $types ) {
 
  // Add to my custom-type post type
  $types[] = 'custom-type';
  $types[] = 'custom-type-2';
  $types[] = 'custom-type-3';
 
  // Remove from blog posts
  unset( $types['post'] );
 
  // Return post types array
  return $types;
  
}, 20 );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top