Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] Manipulating WP Admin Bar Styles with Events
(function( $ ) {
'use strict';
/**
* Hide all of the messages when the option is include and restore the menu items'
* default hover state style.
*/
var hide_menu_notices = function() {
// Setup references to the plugin menu item and all admin notices.
var $admin_button = $( '#wp-admin-bar-toggle-admin-notices a' ),
$messages = $( '.notice, .warning, .error' );
$admin_button.on( 'click', function( evt ) {
evt.preventDefault();
$messages.toggle( 'medium' );
$( this ).trigger( 'blur' );
});
};
$(function() {
hide_admin_notices();
});
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment