/* Add and Change Position of User Menu */ add_filter('jnews_dropdown_link', 'jeg_nav_account_menu', 1); function jeg_nav_account_menu($dropdown) { if (is_user_logged_in()) { /* If you need to get a list of roles */ // global $wp_roles; // print("
" . print_r($wp_roles->roles, true) . ""); $roles = array('administrator', 'author', 'contributor'); /* Set Roles */ $user = wp_get_current_user(); /* Get Role User */ foreach ($roles as $role) { if (in_array($role, $user->roles)) { $temp = $dropdown; unset($dropdown); /* Set the position under this code. */ $dropdown['new_menu'] = array( /* New Menu */ 'text' => 'New Menu', 'url' => 'http://jnews.io' ); $dropdown['account'] = true; /* Set Position of My Account || If not initialized or set to false, the position will always be at the top */ $dropdown['new_menu2'] = array( /* New Menu 2 */ 'text' => 'New Menu 2', 'url' => 'http://jnews.io' ); $dropdown['logout'] = $temp['logout']; /* Set Position of logout || Don't delete this initialization, just move the position */ /* Finish adjusting the Position */ return $dropdown; } } return $dropdown; } }