Skip to content

Instantly share code, notes, and snippets.

Last active March 9, 2019 10:17
What would you like to do?
WP Snippets
//Allow AGCA plugin access only to one person, specified by username
function agca_access_only_admin(){
$screen = get_current_screen();
if($screen->id === 'tools_page_ag-custom-admin/plugin'){
$user = wp_get_current_user();
//Update this ////////////////////
$accessAllowedOnlyTo = 'admin';
if($user->data->user_login != $accessAllowedOnlyTo){
wp_die( 'You are not authorized to see this page.' );
add_action('current_screen', 'agca_access_only_admin');
//Add custom admin bar image
function my_custom_ab_image() {
echo '<style>
#wp-admin-bar-wp-logo > .ab-item, #wp-admin-bar-wp-logo:hover > .ab-item{
background: url( !important;
background-size: contain !important;
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before{
display: none;
add_action('wp_head', 'my_custom_ab_image');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment