How to Add Codex Search to Dashboard in WordPress

Snippets by IsItWP

Do you want to add a search field to your dashboard for searching the WordPress codex? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add codex search to dashboard in WordPress.


All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

function wp_codex_search_form() { 
    echo '<form target="_blank" method="get" action="http://wordpress.org/search/do-search.php" class="alignright" style="margin: 11px 5px 0;"> 
<input type="text" onblur="this.value=(this.value==\'\') ? \'Search the Codex\' : this.value;" onfocus="this.value=(this.value==\'Search the Codex\') ? \'\' : this.value;" maxlength="150" value="Search the Codex" name="search" class="text"> 
<input type="submit" value="Go" class="button" /> </form>'; 
add_filter( 'in_admin_header', 'wp_codex_search_form', 11 ); 

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 27 best WordPress themes for travel blogs and how to start a blog.

Comments  Leave a Reply

  1. Tweets that mention Wordpress Add codex search to dashboard – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com January 21, 2011 at 2:48 pm

    […] This post was mentioned on Twitter by Michael Davis, WPSNIPP. WPSNIPP said: #wordpress Add codex search to dashboard http://bit.ly/eQNP18 #blog please RT 🙂 […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!