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.
Instructions:
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.
[…] 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 🙂 […]