Support Forum
Support › Meta Box Include Exclude › SuggestionResolved
Would be good to be able to disable default WordPress functions such as editor, thumbnails, excerpt etc
ACF has this functionality and would be great to have it included, especially using the builder as you could have them as checkboxes
Does this belong to the post type object itself? I think it's easy to do it with the remove_post_type_support
function (https://developer.wordpress.org/reference/functions/remove_post_type_support/).
Yes, but conditional
Eg: this is the function I wrote that determines the home page and then removes the editor with the remove_post_type_support
/*
* Hide editor on home page
* Since v1.0.0
*/
function homepage_hide_editor() {
// Determine which admin screen we are in
$screen = get_current_screen();
// Ensures we are currently editing
if ( $screen->base != 'post' ) {
// If not editing then escape function
return;
} else {
// Get the home page ID
$frontpage_id = get_option('page_on_front');
// Get current post ID
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
// Checks current post ID matches home page ID
if($post_id == $frontpage_id){
// Removes editor from home page
remove_post_type_support('page', 'editor');
}
}
}
add_action( 'current_screen', 'homepage_hide_editor' );
I would like to see something like this perhaps
$meta_boxes[] = array(
'title' => __( 'Include/Exclude', 'wcd-tradie' ),
'post_types' => 'page',
// Which page to show on
'include' => array(
'slug' => array( 'home' ),
),
// What fields to remove from page
'exclude' => array(
'type' => array( 'editor', 'thumbnail', 'revisions' ),
),
'fields' => array(
array(
'id' => 'text',
'name' => __( 'Text', 'language' ),
'type' => 'text',
'std' => __( 'A Text Field', 'language' ),
),
),
);
OK, I got it. It's actually beyond the scope of the plugin. Include/exclude here means for meta boxes and what you want seems to be for post elements. I will think about this and if it's not hard to implement, I will do it.