I would like to replace the Label the Plugin WP Custome Area sets on the admin bar. This is the initial parto of code that sets the menu title:

public function build_adminbar_menu($wp_admin_bar)
        'id'    => 'customer-area',
        'title' => __('WP Custome Area', 'cuar'),
        'href'  => admin_url('admin.php?page=wpca')

This is the hook i tried but without any joy...

function replace_content()
$content = $wp_admin_bar->get_node('customer-area');
$content->title = __('Custom Title', 'cuar');

Any help will be much appreciated

1 Answer 1


Don't use add_filter with the_content that way; that is meant for a different context - when you are filtering a returned WP post object.

Try something like this instead:

function replace_customer_area_title( $wp_admin_bar ) {
    $newtitle = __('Custom Title', 'cuar');
    $wp_admin_bar->add_node( array( 'id' => 'customer-area', 'title' => $newtitle, ) );

add_filter( 'admin_bar_menu', 'replace_customer_area_title' , 33 ); 

add_node should modify an existing node, if found.

This must run after the original node was added with priority of 32, so we have used 33 here as an example.

  • Thanks CC and birgire for your great solution!! It works perfectly with the editing :) Commented Jun 28, 2016 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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