Title: Remove Based on User Role
Last modified: December 8, 2017

---

# Remove Based on User Role

 *  Resolved [Kevin Pirnie](https://wordpress.org/support/users/kevp75/)
 * (@kevp75)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/)
 * Hi all, wondering if someone can point me in the right direction.
    I have some
   custom user roles, tied to some custom post types. I notice the plugin shows 
   on any post type related to ‘posts’ or ‘pages’, so what I’m wondering is, how
   can I remove it based on my user role?

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [Kevin Pirnie](https://wordpress.org/support/users/kevp75/)
 * (@kevp75)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9764938)
 * `remove_meta_box( 'b2s-post-meta-box-auto', 'tickets', 'normal' );`
 * does not work
 *  [Blog2Social-Support](https://wordpress.org/support/users/blog2socialsupport/)
 * (@blog2socialsupport)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9770177)
 * Hello [@kevp75](https://wordpress.org/support/users/kevp75/),
 * do I understand you correctly, that you are aiming to hide a certain custome 
   post type for a specific user role?
 * In general, only admins can share any content of your blog or website. If you
   asign the user role author or cotributer, these users will only be able to share
   content they have created and published themselves. Therefore, if you have created
   an element with a custome post type, other wp user roles (that are not admins)
   won’t be able to share this content.
 * I will gladly forward your suggestion to add a possibility to regulate the access
   of different user roles for admins. We will keep you posted on any possible implementations
   here.
 * Best regards!
 *  Thread Starter [Kevin Pirnie](https://wordpress.org/support/users/kevp75/)
 * (@kevp75)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9770988)
 * Hi there.
    No, what I am trying to do is hide the plugin meta box for specific
   custom post types.
 * I have created some custom user roles, with a base of administrator (because 
   they need some abilities that admins have), so all my user roles see the meta
   box on all posts / pages / CPT’s (because the CPT is based on a page post type)
 * I just need to know how I can remove the meta box, it seems that the normal method
   of doing so (`remove_meta_box`) does not work with your plugin.
 * Thanks!
 *  [Blog2Social-Support](https://wordpress.org/support/users/blog2socialsupport/)
 * (@blog2socialsupport)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9771769)
 * Hello [@kevp75](https://wordpress.org/support/users/kevp75/),
 * okay, thanks for clarifying. I have forwarded your question to one of our developers.
 *  [Blog2Social-Support](https://wordpress.org/support/users/blog2socialsupport/)
 * (@blog2socialsupport)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9775178)
 * Hello [@kevp75](https://wordpress.org/support/users/kevp75/),
 * I got feedback from our developers and the correct command seems to be the following:
 * `remove_meta_box('b2s-post-meta-box-auto', 'tickets', 'side');`
 * You can check out how to apply this feature here: [https://codex.wordpress.org/Function_Reference/remove_meta_box ](https://codex.wordpress.org/Function_Reference/remove_meta_box)
 * However, the feature kann only be carried out, if the meta box was preiously 
   loaded.
    Please, let me know how this works for you.
 * Best regards.
 *  Thread Starter [Kevin Pirnie](https://wordpress.org/support/users/kevp75/)
 * (@kevp75)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9775454)
 * Still shows
    Used:
 *     ```
       add_action( 'do_meta_boxes', function(){
       					remove_meta_box( 'b2s-post-meta-box-auto', 'tickets', 'side' );
       				} );
       ```
   
 *  [Blog2Social-Support](https://wordpress.org/support/users/blog2socialsupport/)
 * (@blog2socialsupport)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9777826)
 * Hello [@kevp75](https://wordpress.org/support/users/kevp75/),
 * it works if you put it like this:
 *     ```
       add_action( 'do_meta_boxes', 'remove_plugin_metaboxes' );
   
           public function remove_plugin_metaboxes() {
               remove_meta_box('b2s-post-meta-box-auto', 'tickets', 'side');
           }
       ```
   
 * Cheers
 *  Thread Starter [Kevin Pirnie](https://wordpress.org/support/users/kevp75/)
 * (@kevp75)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9778550)
 * the only difference between what you posted, and what I posted is the inline 
   function. Which works for every other item I use like this.
 * I have tried it like that as well, and it still does **NOT** remove the box
 *  [Blog2Social-Support](https://wordpress.org/support/users/blog2socialsupport/)
 * (@blog2socialsupport)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9781682)
 * Hello [@kevp75](https://wordpress.org/support/users/kevp75/),
 * could you tell me in which file and where exactly you are placing this function?
   
   Thank you in advance.
 *  Thread Starter [Kevin Pirnie](https://wordpress.org/support/users/kevp75/)
 * (@kevp75)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9787200)
 * functions.php
 *  [Blog2Social-Support](https://wordpress.org/support/users/blog2socialsupport/)
 * (@blog2socialsupport)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9791673)
 * [@kevp75](https://wordpress.org/support/users/kevp75/),
 * thank you for your feedback. Where exactly in the functions.php file do you insert
   the code? You are alsow more than welcome to contact us via email at customer-
   service(at)blog2social(dot)com to share more indepth information with us. Its
   easier this way for us to help you achieve the result you are aiming for.
 * Best regards.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Remove Based on User Role’ is closed to new replies.

 * ![](https://ps.w.org/blog2social/assets/icon-256x256.png?rev=3076476)
 * [Blog2Social: Social Media Auto Post & Scheduler](https://wordpress.org/plugins/blog2social/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/blog2social/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/blog2social/)
 * [Active Topics](https://wordpress.org/support/plugin/blog2social/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/blog2social/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/blog2social/reviews/)

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [removal](https://wordpress.org/support/topic-tag/removal/)

 * 11 replies
 * 2 participants
 * Last reply from: [Blog2Social-Support](https://wordpress.org/support/users/blog2socialsupport/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/remove-based-on-user-role/#post-9791673)
 * Status: resolved