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 check if post meta key exists or not in wordpress database
- Portable Post Links
- Related Posts by Multiple Tags?
- WP REST API, query total posts in a category
- How to remove_filter that filters iframes in posts? [duplicate]
- Reset/Reorder posts ID in the MySQL wp_posts table
- Select a specific post to display in a news box
- Having trouble with the_post_thumbnail to display thumbnail with custom size
- How to exclude visited posts from loop
- If custom field is empty, use one from a previous post
- Classic Button in Classic editor
- How to add a ‘News’ section to specific posts in WordPress
- How to show category image if no featured image is set?
- Query to get data of a post, if in category?
- Order posts by custom field
- Moving featured image to top of new post editor screen