How to Add a Codex Search Box to the WordPress Dashboard

How to Add a Codex Search Box to the WordPress Dashboard

Many times when working with WordPress you’ll need to search the codex for something. This handy little snippet makes searching the codex very convenient.

It adds a box to the header of the WordPress dashboard, as pictured here. Type in your search and it opens in a new window.

Simply add this snippet to your functions.php file and the box will appear in your dashboard:

/**
* ADD WP CODEX SEARCH FORM TO DASHBOARD HEADER
*/
function wp_codex_search_form() {
echo '

<form class="alignright" style="margin: 11px 5px 0;" action="http://wordpress.org/search/do-search.php" method="get" target="_blank"><input class="text" maxlength="150" name="search" type="text" value="Search the Codex" /> <input class="button" type="submit" value="Go" />

';
}
add_filter( 'in_admin_header', 'wp_codex_search_form', 11 );
Tags: