Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add this code to your theme's functions.php file or a custom plugin file
- function remove_cloud_templates_for_non_admin() {
- if (!current_user_can('administrator')) {
- // remove_menu_page('tdb_cloud_templates'); // if is not working then use the css option
- echo '<style>
- #toplevel_page_tdb_cloud_templates,
- .tdc-panel-button, .edit_tdc_composer, #wp-admin-bar-tdc_edit
- { display: none !important; }
- </style>';
- }
- }
- add_action('admin_menu', 'remove_cloud_templates_for_non_admin');
- function custom_remove_cloud_templates_css() {
- // Only apply the styles to non-admin users
- if (!current_user_can('administrator')) {
- echo '<style>
- #wp-admin-bar-tdc_edit,
- [id^="wp-admin-bar-tdb_template_"]
- { display: none !important; }
- </style>';
- }
- }
- add_action('wp_enqueue_scripts', 'custom_remove_cloud_templates_css');
Advertisement
Add Comment
Please, Sign In to add comment