function hide_menu() {
global $current_user;
$current_user = wp_get_current_user();
$user_name = $current_user->user_login;
//check condition for the user means show menu for this user
if(is_admin() && $user_name != 'USERNAME') {
//your code here
}
}
add_action('admin_head', 'hide_menu');
Related Posts:
- Hide posts from users with a specific role
- How to order posts by custom WP role?
- How to hide post content/meta from everyone except the post author and admin
- SQL User Query by Multiple Roles using PHP
- How to order posts in wp_query by the user role (2 roles in array)
- How to display user order by role
- How can I query users by custom role?
- Why does get_posts only show results for Admins or logged-out users?
- Link Author URL’s based on a custom field
- Meta query orderby meta_value_num sorting by role first
- Set “editor” role to existing user
- Pre_get_posts only show posts by administrator roles
- WP_Query: Query posts only if their access is restricted to logged user’s role
- Displaying content to search engines but via navigation only for registered users.
- Get users query makes the site loading time too big?
- How to know which editor published a post programmatically?
- Can I force WP_Query to return no results?
- Use the page slug in a WP_Query?
- paginate_links() adds empty href to first page and previous link
- Using OR conditions in meta_query for query_posts argument
- Get array of posts from the current archive page loop
- Get posts by menu ID
- count posts from custom taxonomy terms by year
- How to grab metabox value in wp_query meta_query key
- Woocommerce query by price range and custom meta key
- Stop all SQL_CALC_FOUND_ROWS wordpress queries
- Move posts to top of WP_Query if in certain Taxonomy?
- Pagination not working on static page
- How can I create a WP_Query that returns posts where one meta_value
- ‘paged’ in wp_query doesn’t work
- Sorting meta_value as integer doesn’t work
- Get posts from the Main site to sub site – WordPress MultiSites Network
- Custom Field Query – Meta Value is Array
- Get array of current post term ID’s
- WP_Query for showing specific post by id
- Query by custom dates in UNIX Time
- Implementing an OR statement to wordpress wp_query
- Minimize database queries to user tables?
- How to make Meta Query case sensitive?
- Populate tax_query terms parameter with post term
- Orderby the sum of several numeric custom meta fields
- unable to retrive parent page information
- Site not getting correct featured image from my query
- Using WP_Query within an mu-plugin
- wp_query ‘s’, search filter with pagination is not working
- Use more than one query, but prevent duplicates – at scale!
- WP Query related posts by tags
- How to add posts, manually, to a wp_query?
- wp_reset_postdata() does not work as expected
- How to display an other custom post type in a different custom post type’s archive?
- Replacing raw database query to WP_Query
- Stale $GLOBALS[‘post’] after custom WP_Query empty result set bothers my template, whose fault is this?
- WP CLI can’t delete plugin related table
- Inserting HTML to close and open divs in WP_Query loops
- Query only the posts with a post format of “audio”
- Display Current Post’s Position in Custom Taxonomy
- Using Wp_Query without the loop?
- WP Query with multiple tags by get the tags
- Woocommerce pagination and result count after custom loop
- Include latest author posts with pagination in single template?
- How to querry for an item that saved in an array?
- Is it possible to add an argument to a custom function added to a filter hook?
- get_post() is not returning correct value
- Order by meta_key doesn’t work
- Slow Query On Search
- Loop posts based on permalink term
- Child pages not affected by orderby
- Write WP Query that selects posts that are part of the same two categories
- Error in meta_query not get result
- Custom wp_query – I’m getting ‘all’ post, not the specific post in the query
- How to get current page nearest parent id?
- wp Query Posts to display in Nivo Slider
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Filter products on category AND tag
- meta_query – check for multiple meta values in key which holds an array of values
- How to sort wordpress posts already selected by WP_QUERY
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Doing $wpdb->get_results returns NULL, doing the same query in my DB returns correct value
- SEARCH QUERY PLEASE HELP | call_user_func_array() expects parameter 1 to be a valid callback php
- how to get wp_query posts only first letter of alphabet A?
- Merge wp-query and get_users
- WP_Query how to add a thumbnail to the first post from the last 5 posts?
- How order by works?
- Query by meta value (add a dropdown of all values)
- taxquery taxonomy get terms
- Calling a function with WP_Query only ever brings the first result
- get last child post by wp_query
- WP_Query don’t working with fixed post_id and term_taxonomy
- How To Query All Attachment Images Found In Post Galleries
- Create multiple sections for all categories and then queries all the posts for each of those categories
- Using orderby with 2 meta keys
- $wp_query when new WP_Query
- Query to get all the posts of more than 2 meta_value having same meta_key?
- WP Query get posts by specific author IDs if one of several logged in authors
- Query specific number of posts for each post type in specific order
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2
- Prevent URL Parameter Affecting other WP Query
- Sort by multiple columns using get_posts
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)