Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RCP: remove the metabox from the books post type
<?php
/**
* Remove the "restrict this content" meta box from the "books" post type.
*
* @param array $post_types List of post types the meta box should not be added to.
*
* @return array
*/
function pippin_exclude_post_types_from_rcp( $post_types ) {
// We do NOT want the meta box displayed on the "books" post type.
$post_types[] = 'books';
return $post_types;
}
add_filter( 'rcp_metabox_excluded_post_types', 'pippin_exclude_post_types_from_rcp' );
@danfascia

This comment has been minimized.

Copy link

@danfascia danfascia commented May 9, 2017

I kind of think the default behaviour should be to only show restriction options for pages and posts and that in the settings there should be checkboxes to allow turning on of restriction on a per post type basis.

Many plugins use CPTs and users will find it confusing to be able to restrict things like shortcodes or events for example. On the other hand if an advanced user wants to turn this option on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment