WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to change navigation menu in my plugin for each user for example:


But when I apply the above code in my plugin it shows me some errors. What should I do?

share|improve this question
I want do this in plugin not theme – moslem Jan 3 '14 at 13:48
up vote 0 down vote accepted

Create a menu for each type of user in Dashboard >> Appearence >> Menus >> create a new menu (eg http://example.com/wp-admin/nav-menus.php?action=edit&menu=0) Then add a function to your theme's functions.php to switch the menus. Something like as follows:

add_filter('wp_nav_menu_args', 'wp_nav_menu_args_filter');
function wp_nav_menu_args_filter($args = array()) {
   if (is_user_logged_in) { 
        // Menu for Logged In Users
        $args['menu'] = "name-of-user-menu";
        return $args;           
    }   else { 
    // Default Menu
        return $args;       
share|improve this answer
thanks it works but is there way to rename page title in menu for specific user group? – moslem Jan 3 '14 at 14:49
You can do this by using a filter with the_title Have a look here: codex.wordpress.org/Plugin_API/Filter_Reference/the_title – TomC Jan 3 '14 at 14:54
I did but it change every page to 'Dashbord'(that i wan to change with) do you have a right example about it – moslem Jan 3 '14 at 15:56
I figure it out how use it thanks. – moslem Jan 3 '14 at 16:38

You use non existing function is_user_login. You need to use is_user_logged_in() instead.

if( is_user_logged_in() )
share|improve this answer
I know I change it but I mean I want some pages hide from some users in navigate menu – moslem Jan 3 '14 at 13:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.