Created
December 9, 2012 22:29
-
-
Save dimadin/4247291 to your computer and use it in GitHub Desktop.
Filter WordPress admin bar text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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