Last active
July 10, 2017 14:55
-
-
Save JoryHogeveen/256292fc4bf87d69c0ba5ca473a61eee to your computer and use it in GitHub Desktop.
Add this file in /wp-content/mu-plugins/ to securely set a superior admin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: My View Admin As Superior Admin | |
* Description: Define a superior admin for View Admin As | |
* Version: 1.1 | |
* Author: Jory Hogeveen | |
* Author URI: http://www.keraweb.nl/ | |
*/ | |
add_filter( 'view_admin_as_superior_admins', 'my_vaa_superior_admins', 99999 ); | |
function my_vaa_superior_admins( $superior_admins ) { | |
// Get your user object | |
$user = get_user_by( 'email', 'YOUR ADMIN USER EMAIL' ); | |
if ( isset( $user->ID ) ) { | |
// Add your user ID to the list | |
$superior_admins[] = $user->ID; | |
} | |
return $superior_admins; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace
YOUR ADMIN USER EMAIL
with the email address from your user within the WP installation.