You can use wp_get_current_user() function to retrieve user login data. Also use get_edit_profile_url() to get profile page link.
Note: You can use wp_logout_url() function for logout url.
Try following code:
add_action( 'wp_before_admin_bar_render', 'wpdd_admin_bar_edit' );
function wpdd_admin_bar_edit() {
global $wp_admin_bar;
// Show username with profile link
$current_user = wp_get_current_user();
$username = $current_user->user_login;
$profile_link = get_edit_profile_url();
$wp_admin_bar->add_menu( array(
'parent' => 'site-name',
'id' => 'my_profile',
'title' => __( 'Profile: ' ) . $username,
'href' => $profile_link
));
// Logout Link
$logout_url = wp_logout_url();
$wp_admin_bar->add_menu( array(
'parent' => 'site-name',
'id' => 'log-out',
'title' => __( 'Log out' ),
'href' => $logout_url
));
}
Related Posts:
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Is it OK to move admin menu items?
- Custom Post Type and taxonomies’s labels localization not working
- How to group navigation items in the admin panel
- Metaboxes inside Tab
- Custom Post Type Causing Admin Sidebar UI Issue
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Customize Edit Post screen for Custom Post Types?
- Filter by custom field in custom post type on admin page
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- Merge two custom post types into one admin page?
- Remove the “View” Link in Post Admin
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- Multiple custom post types under one admin menu
- How can I change the admin search posts fields?
- Custom post type: Add “Edit | Quick Edit | Trash | View” links to date (if title is not shown in column)?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- How can I filter posts by post_parent in the admin?
- Custom post type admin search
- Ordering posts by custom taxonomy in admin area
- Can I have Post Types under other Post Types in Admin menu?
- How to add custom columns to Custom Post Type admin screen
- Filter admin columns by custom post field value
- Filter by custom Field for Custom post type Admin Listing
- Add Post type menu to another menu
- How do I create multiple post types in same menu section in WP-admin?
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- How to Add Admin Bar and Admin Menu or Submenu Notification Bubbles?
- How to get search results in the backend admin on a custom post type?
- Admin pages have no content
- Remove Custom Post Type menu for non-administrator users.
- No results searching custom post type in admin panel
- How to add post_author column to custom post type
- Only Show an Author Their Custom Post Types
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- how to only have one custom post type post?
- Change order of an item under “New” on the admin bar
- Change admin post thumbnail size for custom post type only
- Filters post in admin with dropdown select, custom post type
- How can I use a different default admin menu icon for custom post type?
- Admin List Dynamic Heading
- WordPress User Roles, Custom Post Types, and Admin views
- Settings page above CPT page in admin section
- How to search CPT’s by meta query from the admin dashboard?
- Add theme options to custom post type admin pages [closed]
- How do I alter the position of a Custom Post Type menu item within my plugin admin menu?
- Changing ‘view’ link for custom post type on list post screen?
- Sort admin area by custom Event Date field
- How to add custom post type under option page
- Add html to cpt main page / admin edit.php
- Trying to add script to specific admin page is not working
- Remove rows in the manage post/page view
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Access $post object when adding custom columns to list table
- Setting proper query for multiple custom admin filters
- Insert & order custom post types in/as submenu
- Customize my custom taxonomy table in Admin panel
- Get parse_query filter to return slug instead of id
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Notify admin on new submit
- On update or create post redirect to current post position in list
- Possibilities for the edit.php admin panel? [closed]
- Add Custom Post type menu to another menu in specific location
- Admin Column does not populate with data
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- 2 Different Custom Post Types in Submenu
- Add a ‘guide’ image to custom post type admin page
- New “Custom Types” item in admin menu. Is this a plugin or a new wordpress feature?
- Linking to Post Types from wp-admin
- Plugin or method of allowing user to rearrange custom post types with drag and drop?
- sortable columns for multiple custom post types not working
- Add ‘page template’ column to dashboard for CPTs
- Reusable metabox backend and frontend
- Filter posts of custom post type by meta key in (List All Section)
- get_post_types not working properly in admin
- Top level menu position overwrites another entry
- admin_head-post.php only works after publish / update
- Custom post type, taxonomy and admin bar
- Require custom post type if is_admin() – template doesn’t show up?
- adding page types in menu
- using the loop in custom meta is messing up ‘add new’ post type
- Restrict admin pages for specific user role
- Cannot include custom post item within a menu
- remove duplicate name submenu link from the custom post type
- require/include php file in add_menu()
- Subset of Custom Post Type From Admin Menu Based on Meta Data
- Delete all custom posts then upload a new CSV of events
- Create an administation subpage containing posts in a certain category
- Show custom taxonomy not in submenu
- Customising the admin columns for a custom post type, but now most of the built in categories don’t display?
- How to add elements to WordPress appearance->menu admin?
- Admin menu post type
- Issue on CPT Custom Menu Position in WP
- How to change the default orderby from “Date” to e.g. “Title” or my custom column in content type records list in admin?
- Change column of row action (Quick Edit) links in WP_List_Table
- Collection of fields in a single post
- Prevent users from changing post status
- Custom Plugin w/ Custom Post Types – Custom Posts Are Showing at all Privilege Levels – Is this possible to adjust?
- wordpress custom post type shows other cpt posts in admin menu
- Custom post types not showing in the admin menu on production, but shows locally