Limiting Admin Backend Search to Title

This is possible by altering the search query via the posts_search hook. http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php#L2202 A default search query will look like this: ..AND (((wp_posts.post_title LIKE \’%search terms%\’) OR (wp_posts.post_content LIKE \’%search terms%\’))) We need to remove the post content search, a regular expression should be enough. add_filter( ‘posts_search’, ‘wpse_45153_filter_search’, null, 2 ); function wpse_45153_filter_search( $search, $a_wp_query … Read more

Search returns everything if search term has a space

Chances are it’s searching using the ‘OR’ operand, which for will pull up everything that has those common words – ‘of the’. There are a number of alternate search plugins for WordPress – we’ve had great results (pun intended) using Relevanssi.

multi custom fields and taxonomy search

I’m not sure if I fully understand what you’re trying to do, but I always recommend the Advanced Custom Fields plugin to people looking to make custom fields more useful and intuitive. Great plugin with great support and documentation. It really opens up a lot of possibilities.

How to insert meta keyword to search result page

that is relatively easy. you can add this to your theme’s functions.php file add_action(‘wp_head’, ‘add_meta_tags’); function add_meta_tags(){ if(is_search()){ $search_keyword = get_search_query(); echo ‘<meta name=”META_NAME” content=”META TESTING” />’; } } you may change echo ‘<meta name=”META_NAME” content=”META TESTING” />’; as you want to output the meta tags. however, your theme needs to call wp_head(); for this … Read more

Use wordpress search to display results within a post

WP_Query accepts a search parameter, ‘s’. Hence, you can just do this: <?php $related_posts = new WP_Query( ‘s=” . the_title_attribute( “‘, ”, 0 ) ); if( $related_posts->have_posts() ) : while( $related_posts->have_posts() ) : $related_posts->the_post(); // STUFF endwhile; endif; wp_reset_postdata(); ?> While we’re here, note the use of WP_Query which is more appropriate for a secondary … Read more

How to build an advanced search form by post type?

In your search form, add an input with name=”post_type” and value=”customposttypehere”. You can either have this as a hidden input or a text entry or a combobox or radio buttons etc, so long as it’s inside the search form. The same is true for any other query vars like post_type etc that you would normally … Read more