Are you looking for a way to customize the WordPress admin quick navigation menu including welcome message and links? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add custom links in WordPress 3.0+ admin quick navigation.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
add_filter( 'admin_user_info_links', 'filter_user_admin_menu' ); function filter_user_admin_menu() { global $current_user; get_currentuserinfo(); $links = array(); $links[5] = sprintf( __('Sup!, %1$s'), $current_user->display_name ); $links[6] = '<a href="users.php" title="Manage Users">Manage Users</a>'; if ( current_user_can( 'publish_posts' ) ) $links[10] = '<a href="' . admin_url() . 'edit.php" title="">Manage Posts</a>'; $links[14] = '<a href="profile.php" title="' . esc_attr__('Edit your profile') . '">' . __('Your Profile') . '</a>'; $links[15] = '<a href="' . wp_logout_url() . '" title="' . esc_attr__('Log Out') . '">' . __('Log Out') . '</a>'; return $links; }
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 25 best WooCommerce plugins to grow your sales and how to create a file upload form in WordPress.
great trick. wordpress should have roled it out by default. great share
Cool glad to hear you like the snippet.