Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Hide Yoast SEO meta box from non-admins
- Version: 1.0
- */
- /**
- * Hide SEO metabox from non-admins
- */
- function jp_remove_yoast_metabox() {
- // If not admin, remove SEO box
- if ( ! current_user_can( 'administrator' ) ) {
- $post_types = array( 'page', 'post' ); // add any custom post types here
- foreach( $post_types as $post_type ) {
- remove_meta_box( 'wpseo_meta', $post_type, 'normal' );
- }
- }
- }
- add_action( 'add_meta_boxes', 'jp_remove_yoast_metabox', 99 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement