Skip to content

Instantly share code, notes, and snippets.

@dimadin
Created December 9, 2012 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimadin/4247291 to your computer and use it in GitHub Desktop.
Save dimadin/4247291 to your computer and use it in GitHub Desktop.
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