Skip to content

Instantly share code, notes, and snippets.

@JoryHogeveen
Last active July 10, 2017 14:55
Show Gist options
  • Save JoryHogeveen/256292fc4bf87d69c0ba5ca473a61eee to your computer and use it in GitHub Desktop.
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.
<?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;
}
@JoryHogeveen
Copy link
Author

Replace YOUR ADMIN USER EMAIL with the email address from your user within the WP installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment