Last Updated:

WordPress, how to remove the meta box of the Super Socializer plugin in the post editing panel

ignistech
ignistech Computer Science

You may have a need to hide a metabox. Surely the intention of the programmer when inserting a metabox is, in many but not all cases, to improve the service.

Not all webmasters appreciate the fact that simple users can control functions of the site also for security reasons. From my point of view, all addons should give the possibility to choose ‘free of charge’ which elements to make visible to simple users.

Whatever the motivation, however, I will now explain how to remove the metabox of the super socialiser plugin, which is located within the article editing panel.

In the functions.php file of your theme, you have to insert the following code:

if (!current_user_can(‘edit_pages’)){
add_action(‘add_meta_boxes’,‘my_remove_super_socializer’,100000);
}
function my_remove_super_socializer_post_metabox(){
remove_meta_box(‘glossary_post_metabox’,‘post’,‘normal’);
}
add_action(‘admin_menu’,‘wpdocs_remove_post_custom_fields’);
if(is_admin()){
add_action(‘admin_menu’,‘wpdocs_remove_meta_boxes’);
}

I recommend creating a child theme because otherwise, if you update the theme you will lose the change

Avoid using the following standard code because it will give you problems:

function remove_my_post_metaboxes(){
remove_meta_box(‘authordiv’,‘post’,‘normal’);
remove_meta_box(‘commentstatusdiv’,‘post’,‘normal’);
remove_meta_box(‘commentsdiv’,‘post’,‘normal’);
remove_meta_box(‘postcustom’,‘post’,‘normal’);
remove_meta_box(‘postexcerpt’,‘post’,‘normal’);
remove_meta_box(‘revisionsdiv’,‘post’,‘normal’);
remove_meta_box(‘slugdiv’,‘post’,‘normal’);
remove_meta_box(‘trackbacksdiv’,‘post’,‘normal’);
remove_meta_box(‘related_post_metabox’,‘post’,‘high’);
}
add_action(‘admin_menu’,‘remove_my_post_metaboxes’);

I tested this modification with version 7.9.4 of the plugin. Before modifying anything make sure you have a backup and know what you are doing.

Comments