Hide Cusmin Appearance in WordPress


/ Published in: PHP
Save to your folder(s)

Hide Cusmin plugin appearance from all other users, even administrators.
Add this code to active themes's functions.php


Copy this code and paste it in your HTML
  1. // HIDE CUSMIN
  2.  
  3. //Cusmin admin user ID
  4. const CUSMIN_ADMIN_USER_ID = 1;
  5.  
  6. function hide_cusmin_from_plugins_list() {
  7. if(get_current_user_id() == CUSMIN_ADMIN_USER_ID){
  8. return;
  9. }
  10. global $wp_list_table;
  11. $hidearr = array('cusmin/cusmin.php');
  12. $myplugins = $wp_list_table->items;
  13. foreach ($myplugins as $key => $val) {
  14. if (in_array($key,$hidearr)) {
  15. unset($wp_list_table->items[$key]);
  16. }
  17. }
  18. remove_submenu_page('options-general.php','cusmin');
  19. }
  20. function remove_cusmin_options_page() {
  21. if(get_current_user_id() == CUSMIN_ADMIN_USER_ID){
  22. return;
  23. }
  24. //Removes cusmin link from admin menu
  25. global $pagenow;
  26. remove_submenu_page('options-general.php','cusmin');
  27.  
  28. //Redirects from Cusmin options page to admin homepage
  29. if ( $pagenow == 'options-general.php' && !empty($_GET['page']) && $_GET['page'] == 'cusmin' ) {
  30. wp_redirect( admin_url() );
  31. }
  32. }
  33. add_action( 'pre_current_active_plugins', 'hide_cusmin_from_plugins_list' );
  34. add_action( 'admin_init', 'remove_cusmin_options_page', 999);
  35. // HIDE CUSMIN

URL: https://cusmin.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.