How to hide Themify Custom Panel for certain roles

All the Themify themes include a Custom Panel that allows you to set several options when editing a post, page and even specialized types like a portfolio.
At times, we might want to hide it from other users who are only allowed to write a post without changing any option. For this, we can use the filter 'themify_do_metaboxes' and remove them for a certain user role.

Filter usage example

In this example, we will hide the Themify Custom Panel for all users that are can't manage the site options, usually only administrators have that capability.

1. create a file named custom-functions.php in the theme root folder
2. open it and paste
[code type=php]
[/code] 3. save the file. If you were editing the file locally, upload it to the theme folder in your server by FTP.

Hide Themify Custom Panel and Builder

The above example does not disable Builder backend editor, if you wish to hide the Themify Custom Panel and Builder editor as well you can use:
[code type=php]
[/code]

List of roles to selectively hide the panel

To show the panel for other roles than administrator and hide it to lower roles, change 'manage_options' to one of these

  • Only admins and editors: change to [code type=php]delete_others_posts[/code]
  • Only admins, editors and authors: change to [code type=php]delete_published_posts[/code]
  • Only admins, editors, authors and contributors: change to [code type=php]edit_posts[/code]

For example, let's show the panel to administrators and editors only:
[code type=php]
[/code]

If you want to hide the Themify custom panel but allow your editors and other users with inferior roles to setup a Featured Image in their posts, add the code below so the meta box is not removed. This is just a combination of the first code in this page with an extra line to avoid removing the meta box:
[code type=php]
[/code]

Hide options in Customize screen

If you want to disable the options in Customize screen can use this:
[code type=php]