Guest User

Untitled

a guest
Aug 3rd, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // Add this code to your theme's functions.php file or a custom plugin file
  2. function remove_cloud_templates_for_non_admin() {
  3. if (!current_user_can('administrator')) {
  4. // remove_menu_page('tdb_cloud_templates'); // if is not working then use the css option
  5. echo '<style>
  6. #toplevel_page_tdb_cloud_templates,
  7. .tdc-panel-button, .edit_tdc_composer, #wp-admin-bar-tdc_edit
  8. { display: none !important; }
  9. </style>';
  10.  
  11. }
  12. }
  13. add_action('admin_menu', 'remove_cloud_templates_for_non_admin');
  14.  
  15.  
  16. function custom_remove_cloud_templates_css() {
  17. // Only apply the styles to non-admin users
  18. if (!current_user_can('administrator')) {
  19. echo '<style>
  20. #wp-admin-bar-tdc_edit,
  21. [id^="wp-admin-bar-tdb_template_"]
  22. { display: none !important; }
  23. </style>';
  24. }
  25. }
  26. add_action('wp_enqueue_scripts', 'custom_remove_cloud_templates_css');
Advertisement
Add Comment
Please, Sign In to add comment