Created
December 25, 2011 04:16
-
-
Save markjaquith/1518715 to your computer and use it in GitHub Desktop.
Removes "Howdy" from the WordPress 3.3 toolbar
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
<?php | |
/* | |
Plugin Name: No Howdy | |
Description: Removes "Howdy, " from the toolbar | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ | |
class CWS_No_Howdy { | |
const howdy = 'Howdy, %1$s'; | |
const no_howdy = '%s'; | |
public function __construct() { | |
// Limit the scope of our filter to the 'admin_bar_menu' hook between 0 and 9999 | |
add_action( 'admin_bar_menu', array( $this, 'hook_in' ), 0 ); | |
add_action( 'admin_bar_menu', array( $this, 'hook_out' ), 9999 ); | |
} | |
public function hook_in() { | |
add_filter( 'gettext', array( $this, 'kill_howdy' ) ); | |
} | |
public function hook_out() { | |
remove_filter( 'gettext', array( $this, 'kill_howdy' ) ); | |
} | |
public function kill_howdy( $text ) { | |
if ( self::howdy === $text ) { | |
$this->hook_out(); // We're done, so let's remove ourselves. | |
return self::no_howdy; | |
} | |
return $text; | |
} | |
} | |
new CWS_No_Howdy; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How about an additional
remove_action( 'admin_bar_menu', array( $this, 'hook_out' ), 9999 );
before line 32?