Skip to content

Instantly share code, notes, and snippets.

@thebigtine
Last active March 4, 2020 08:54
Show Gist options
  • Save thebigtine/32da46e6f83d348a16e1bbab9ddeba7f to your computer and use it in GitHub Desktop.
Save thebigtine/32da46e6f83d348a16e1bbab9ddeba7f to your computer and use it in GitHub Desktop.
<?php
// add class to admin body tag
function add_body_classes( $classes ) {
$current_user = wp_get_current_user();
// Right: Add a leading space and a trailing space.
$classes .= ' current-user-' . $current_user->ID . ' ';
return $classes;
}
add_filter('admin_body_class', 'add_body_classes');
// add classes below to hide then. change number the the id of the user
function my_custom_fonts() {
echo '<style>
.current-user-2 #menu-posts,
.current-user-2 #menu-comments,
.current-user-2 #menu-posts-brands,
.current-user-2 #menu-posts-brochure,
.current-user-2 #menu-posts-ranges,
.current-user-2 #toplevel_page_delete_all_posts,
.current-user-2 #toplevel_page_caldera-forms,
.current-user-2 #toplevel_page_wpforms-overview,
.current-user-2 #menu-appearance,
.current-user-2 #menu-plugins,
.current-user-2 #menu-users,
.current-user-2 #menu-tools,
.current-user-2 #menu-settings,
.current-user-2 #toplevel_page_edit-post_type-acf-field-group,
.current-user-2 #toplevel_page_meta-box,
.current-user-2 #toplevel_page_flow-flow,
.current-user-2 #toplevel_page_frasettings,
.current-user-2 #toplevel_page_motopress-slider,
.current-user-2 .wp-menu-separator,
.current-user-2 #wp-admin-bar-updates,
.current-user-2 #wp-admin-bar-comments,
.current-user-2 #wp-admin-bar-new-content,
.current-user-2 #wp-admin-bar-feed-imports,
.current-user-2 #wp-admin-bar-imagify,
.current-user-2 #wp-admin-bar-wp-rocket
{
display: none;
}
</style>';
}
add_action('admin_head', 'my_custom_fonts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment