How to remove the related post plugin meta box from the post editing panel

This plugin lets you put the related posts in the bottom of the post. This feature is very interesting and useful. The plugin also allows the author an article to choose what related posts are.

It might also be useful to disable this feature if you want to maintain a backend interface for the publication of clean items and without too many features that could confuse the end user.

However, if you have the ability to disable this feature for your users so that they have the unlocked interface you can insert the following code into the file functions.php :

//hide super socializer
if ( ! current_user_can( 'edit_pages' ) ) {
add_action( 'add_meta_boxes', 'my_remove_the_champ_meta_box', 100000 );
}
function my_remove_the_champ_meta_box(){
remove_meta_box( 'the_champ_meta', 'post', 'normal' );
}
add_action( 'admin_menu' , 'wpdocs_remove_post_custom_fields' );
if ( is_admin() ) {
add_action( 'admin_menu', 'wpdocs_remove_meta_boxes' );
}

I suggest you create a child theme where to put this code. Any subsequent updates may overwrite the code.

The format I used also serves to remove other features in the posts section, I’ve written other articles that talk about it.

Avoid using the standard system with such a code or there will be problems:

function remove_my_post_metaboxes() {
remove_meta_box( 'authordiv','post','normal' ); // Author Metabox
remove_meta_box( 'commentstatusdiv','post','normal' ); // Comments Status Metabox
remove_meta_box( 'commentsdiv','post','normal' ); // Comments Metabox
remove_meta_box( 'postcustom','post','normal' ); // Custom Fields Metabox
remove_meta_box( 'postexcerpt','post','normal' ); // Excerpt Metabox
remove_meta_box( 'revisionsdiv','post','normal' ); // Revisions Metabox
remove_meta_box( 'slugdiv','post','normal' ); // Slug Metabox
remove_meta_box( 'trackbacksdiv','post','normal' ); // Trackback Metabox
remove_meta_box( 'related_post_metabox','post','high' ); // Trackback Metabox
}
add_action('admin_menu','remove_my_post_metaboxes');

I tested this change with the 2.0.2 plugin version. Before editing Make sure you make a backup, make sure you know what you are doing well and make sure the function names do not conflict with other names already in the code.

Rispondi