Hide Admin Bar Search is now in the WordPress Plugin Directory

Woohoo, 1.0! Basically the same as my earlier post, with a little cleanup and some readme.txt action: http://wordpress.org/extend/plugins/hide-admin-bar-search/

Fresh from the readme:

Hide Admin Bar Search

Contributors: helenyhou
Tags: admin bar
Requires at least: 3.1
Tested up to: 3.1

Small plugin to hide the search box in the admin bar in both dashboard and site views.

Description

Hide Admin Bar Search is a small plugin that hides the search box in the 3.1 admin bar in both the dashboard and front-end site views. Useful for those who are not using the built-in WordPress search in the usual way or anybody who wants a more minimal admin bar.

Installation

Hide Admin Bar Search is most easily installed automatically via the Plugins tab in your blog administration panel. Activate to hide the search box – no settings required.

Manual Installation
  1. Upload the `hide-admin-bar-search` folder to the `/wp-content/plugins/` directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Enjoy your cleaner admin bar

Frequently Asked Questions

Why would I want to do this?

The admin bar search uses the default WordPress search. If you are not using that search, or if you just want the admin bar to be more minimal, this is for you.

Can I choose to show the search box in the dashboard or site view?

Not at this time – this plugin is meant to be as simple as possible.

Changelog

1.0
  • First version

Hiding the search form in the 3.1 Admin Bar

I love the new admin bar in WordPress 3.1, but the search box just isn’t needed for Eastman thanks to a combination of things. For the Eastman site, we are not using the built-in WordPress search in the usual way. We are also not directing all searches through Google, so having search.php just completely redirect doesn’t. We also already have a site search box in the header, anyway, so it’s kind of redundant (even if it’s just web editors who are seeing the admin bar search).

I looked into the rendering code for the admin bar and didn’t see a hook to manipulate the search box like there are for other menu items. This seems rather unfortunate to me and I may ask the question on wp-hackers later on tonight to see if I’m missing something, but I figured I could probably use CSS to hide it for now. I mean, it’s not like ESM web editors are going to use Firebug and resurrect the form (and I’d have to admit that I’d be really impressed if any of them could do it), and it’s not like the search itself is nonfunctional, it just doesn’t quite behave the way you think it might when searching the entire site. Now, because I want to create a consistent experience, I want to be sure that the search box doesn’t show even if the rare network site uses a different theme, so I figured I’d make a simple plugin and network activate it. So, here goes the plugin:

<?php
/*
Plugin Name: Hide Admin Bar Search
Plugin URI: http://www.helenhousandi.com/wordpress
Description: Uses CSS to hide the search box in the admin bar. Helpful if you don't use the built-in WordPress search like usual.
Version: 1.0
Author: Helen Hou-Sandi
Author URI: http://www.helenhousandi.com
*/

if ( !function_exists('hide_admin_bar_search') ) {
	function hide_admin_bar_search () { ?>
		<style type="text/css">
		#wpadminbar #adminbarsearch {
		display: none;
		}
		</style>
		<?php
	}
	add_action('admin_head', 'hide_admin_bar_search');
	add_action('wp_head', 'hide_admin_bar_search');
}

What we are using the built-in search for: the News Room (a category) and Faculty (a custom post type). The one for Faculty does something pretty cool – to be written about more at another time.