Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filter WordPress admin bar text
/**
* Filter admin bar strings.
*/
function md_filter_admin_bar_strings( $translation, $original_text, $domain ) {
if ( 'About WordPress' == $original_text )
$translation = 'About this site';
return $translation;
}
/**
* Register gettext filter for admin bar.
*/
function md_add_ab_gettext_filter() {
add_filter( 'gettext', 'md_filter_admin_bar_strings', 10, 3 );
}
add_action( 'admin_bar_init', 'md_add_ab_gettext_filter', 1 );
add_action( 'wp_before_admin_bar_render', 'md_add_ab_gettext_filter', 1 );
/**
* Unregister gettext filter admin bar.
*/
function md_remove_ab_gettext_filter() {
remove_filter( 'gettext', 'md_filter_admin_bar_strings', 10, 3 );
}
add_action( 'wp_after_admin_bar_render', 'md_remove_ab_gettext_filter', 1000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.