Last active
November 26, 2016 11:49
-
-
Save max-kk/eba579fa878170bd99353369e4bc2116 to your computer and use it in GitHub Desktop.
Wordpress :: Remove (hide) meta boxes from Post editing from non admin's (Comments, Slug, Categories) + Yoast Seo + Revolution slider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function wpse605901_remove_metaboxes() { | |
| if ( !current_user_can('manage_options') ) { | |
| remove_meta_box( 'categorydiv' , 'post' , 'normal' ); | |
| remove_meta_box( 'formatdiv' , 'post' , 'normal' ); | |
| remove_meta_box( 'um-admin-access-settings' ); | |
| remove_meta_box( 'tagsdiv-post_tag' , 'post' , 'normal' ); | |
| remove_meta_box( 'trackbacksdiv' , 'post' , 'normal' ); | |
| remove_meta_box( 'postcustom' , 'post' , 'normal' ); | |
| remove_meta_box( 'commentstatusdiv' , 'post' , 'normal' ); | |
| remove_meta_box( 'slugdiv' , 'post' , 'normal' ); | |
| } | |
| } | |
| add_action( 'admin_menu' , 'wpse605901_remove_metaboxes', 999 ); | |
| function do_meta_boxes_remove_metaboxes() { | |
| if ( !current_user_can('manage_options') ) { | |
| remove_meta_box( 'mymetabox_revslider_0', 'page', 'normal' ); | |
| remove_meta_box( 'mymetabox_revslider_0', 'post', 'normal' ); | |
| remove_meta_box('wpseo_meta', 'post', 'normal'); | |
| } | |
| } | |
| add_action( 'do_meta_boxes' , 'do_meta_boxes_remove_metaboxes', 999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment