Ankit Sudhera Portfolio Website

Programming is my Passion
Provide Training is my skill
Quality and Commitment is my Life's Goal
Quality and Commitment is my Life's Goal
Programming is my Passion
Provide Training is my skill
Quality and Commitment is my Life's Goal
Quality and Commitment is my Life's Goal
Programming and Support is my Quality
Programming and Support is my Quality
Programming and Support is my Quality

Forum

how to hide ‘Howdy’...
 
Notifications
Clear all

how to hide ‘Howdy’ with WP 6.6.1 anymore

1 Posts
1 Users
0 Reactions
46 Views
(@ankitbnl406)
Member Admin
Joined: 2 years ago
Posts: 7
Topic starter  

Please see the below 2 scripts to remove the howdy in Wordpress, you can use any 1:

Solution 1:

add_filter( 'admin_bar_menu', 'replace_wordpress_howdy', PHP_INT_MAX - 100);
function replace_wordpress_howdy( $wp_admin_bar ) {
	$my_account = $wp_admin_bar->get_node('my-account');
	$wp_admin_bar->add_node( array(
	'id' => 'my-account',
	'title' => substr($my_account->title, strpos($my_account->title, '<span class="display-name">')),
	));
}

Solution 2:

function pac_da_custom_admin_bar_user_name() {
    global $wp_admin_bar;
    // Define the ID of the node representing the "My Account" section in the admin bar.
    $node_id = 'my-account';
    // Check if the specified node exists in the admin bar.
    if ($wp_admin_bar->get_node($node_id)) {
        // Get the current title of the "My Account" section.
        $current_title = $wp_admin_bar->get_node($node_id)->title;
        // Split the current title into an array based on the comma and space separator.
        $newTitle = explode(", ", $current_title);
        // Update the "My Account" section title with the second part of the split title if available, 
        // otherwise keep the current title.
        $wp_admin_bar->add_node(array(
            'id' => $node_id,
            'title' => isset($newTitle) && isset($newTitle[1]) ? $newTitle[1] : $current_title,
        ));
    }
}
// Hook the custom admin bar user name function to run before the admin bar is rendered.
add_action('wp_before_admin_bar_render', 'pac_da_custom_admin_bar_user_name');
This topic was modified 2 months ago by ankitbnl406

   
Quote