Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. $all_administrators = get_users(array('role' => 'Administrator'));
  3.  
  4. foreach ($all_administrators as $key => $admin_user) {
  5.     $hidden_widgets = get_user_option('metaboxhidden_dashboard', $admin_user->ID);
  6.    
  7.     if( !is_array($hidden_widgets) )
  8.         $hidden_widgets = array();
  9.  
  10.     // Hide widget of Companion Sitemap Generator
  11.     if( !in_array('csg-sitemap-gen', $hidden_widgets) ) {
  12.         array_push($hidden_widgets, 'csg-sitemap-gen');
  13.         update_user_option($admin_user->ID, 'metaboxhidden_dashboard', $hidden_widgets);
  14.     }
  15.     // Hide widget PHP LOG
  16.     if( !in_array('ws_php_error_log', $hidden_widgets) ) {
  17.         array_push($hidden_widgets, 'ws_php_error_log');
  18.         update_user_option($admin_user->ID, 'metaboxhidden_dashboard', $hidden_widgets);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement