This effectively removes metaboxes IF the current user is a contributor. This does not remove any admin column data ( like SEO Description and such when viewing pages ). You need to define which post types to run it on in the $post_types
array which will then loop through and target specifically the aiosp
metabox ( that’s the metabox ID ) and removes it.
function wpse_205080() {
if( current_user_can( 'contributor' ) ) {
$post_types = array( 'page', 'post' );
foreach( $post_types as $type ) {
remove_meta_box( 'aiosp', $type, 'normal' );
}
}
}
add_action( 'do_meta_boxes', 'wpse_205080' );
There’s a ton of questions regarding removing metaboxes if you search through the site. The big thing is taking advantage of your browser’s Developer Tools to find the ID.
Related Posts:
- Allow user to “edit_others_posts” to save only, not publish
- How can I retrieve multiple get_post_meta values efficiently?
- Can I force a metabox to be in one column?
- How to add a new tab to page editor
- Listen to Post action
- How to add metabox for post of specific category
- How to limit user to publish post per day and per role?
- Add role that restricts user to post in specific category
- How to batch update post content with custom post meta value
- upload image in a meta box
- Remove Posts Quick Edit link for specific user role? WP 3.3
- meta_box or custom_field as a second tinymce post-instance?
- 1 column admin screen options – move submitdiv to bottom
- multicheck box for post metabox
- Create A Metabox For A Custom Field
- Have save_post write to database image meta [closed]
- Allow role to delete posts but block him the wp-admin
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- Using radio button meta data from a custom meta box
- Multiple authors for single post without plugin
- If specific user role then sticky post
- Save list from a custom meta box?
- Using Custom Posts with Metaboxes and Drop-downs
- Downgrade user from role that allows post creation
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- Automatic value for custom fields for posts
- How to rename “Publish” metabox title in post screen
- Understanding and using metaboxes in posts
- Posts with multiple authors with different roles
- Dashboard :10 Last draft page and 10 last pending review page (metabox)
- Update a users role based on number of posts published
- Change user role when post approve
- Adding custom fields to bbpress reply form
- Stop users posting into category while still seeing contents of the category
- How to allow users to post only in certain category and hide elements from edit page?
- Meta value does not save for scheduled posts
- Post visibility based on user role
- “edit_published_posts” and “edit_other_post” issue
- User levels and post visibility
- Simultaneous admin updates causes custom fields to not update
- (solved) getting post author’s user role
- Delete post after x minutes if user role is
- How to I retrieve the ID from the Posts page?
- How to save meta checkbox WordPress
- Show posts by author of membership level (Paid Membership Pro)
- Hide custom metabox value from custom fields
- Hide comments and posts posted by other user
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- Get post meta retrieving wrong value
- Upload attachment from external site
- Show metabox value last post excerpt, title and link
- Updating post meta for checkbox
- How can I tell if a post has been published at least once?
- Adding JS functionality to the Publish button in wp-admin/post.php
- Get post related to particular meta box? [closed]
- Adding a meta box to determine the sidebar [closed]
- Simple Custom Metabox Not Saving
- Why my meta boxes won’t show in front post page?
- Display content between two dates?
- Show 10 latest posts only from users with contributors role
- How to get value in radio input in post meta box?
- Display default matabox of posts(add category) wordpress
- Adding an option to post editor to show a site disclaimer or message
- Limit Post Creation Count by Author or Role
- allow user to create a draft post but not publish wordpress
- Administrator Posts
- allow editor/author to publish others posts but not publish their own
- Changing a users posts to drafts upon role change
- I need show posts by customer (Shortcode)
- Allow author to duplicate but not edit post
- Disable `create_post` for built-in post type
- Add new post only in assigned category
- Add meta box for Featured Image caption in wp-admin/post-new.php
- Meta boxes not saving
- Admin Post List Only Show One Category
- How can add metabox for post of specific category before save post and after save post [duplicate]
- Some comment box wordpress in 1 post [closed]
- Display metabox with date
- How to separate metabox data in front/backend
- How can I create a menu items from meta box based on users input
- Authors can edit all posts, except when an owner is specified?
- each user having category with their name and can add sub categories post in that category
- WordPress strips some attributes for author posts
- Display posts with id equal to relationship value
- How to allow Contributors to edit their own posts, whilst still needing to be reviewed by an admin?
- Only an admin can add new tags
- Get WordPress post content by post id
- Get page ID of page that is set as the posts page
- Get Posts Under Custom Taxonomy
- How to limit the number of posts that WP_Query gets?
- Stop WordPress Wrapping Images In A “P” Tag
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Turn a URL into an Attachment / Post ID
- GET the excerpt by ID
- Stop WordPress automatically adding tags to post content
- Determine if page is the Posts Page
- How to get ‘post_content’ without stripping tags?
- How to add an admin notice upon post save/update
- Print Current Post Index number within Loop
- Should we trust the post globals?