How we filter the search base on post-meta tags

Thats because you got the meta_query wrong. Check documentation in Codex Your query should be: $args = array( ‘posts_per_page’ => 30, ‘paged’ => $paged, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘post_state’, ‘value’ => $stateName, ‘compare’ => ‘=’ // not necesary by default is “=” ) ) ); Basically you … Read more

Custom search: Search posts but display parent page in results

Ok I have figured it out; added the following to functions.php: add_filter( ‘posts_request’, ‘my_request_filter’, 10, 2 ); function my_request_filter($sql, $query) { if($query->is_main_query() && is_search()) { $sql = “SELECT * FROM wp_posts WHERE post_content LIKE ‘[smoothslider%’ AND post_parent !=’0′”; } return $sql; } I understand that with no access to the database or being able to … Read more

Google Search and Own Website Search?

Why not create a form that submits direct to Google? This would be the simplest solution (assuming you want to search every website in the world): <form action=”http://www.google.com/search” method=”get”> <input type=”text” name=”q” placeholder=”Search Google”/> <input type=”submit” /></form> I believe that would do the job you want it to. The result would look something like: https://www.google.com/search?q=this%20that

Search Woocommerce product titles only

It turns out the free Relevanssi plugin does this rather well. I was afraid it would only search posts and not custom post types, but it does it all… and rather well! It only requires a simple filter added to your theme’s functions.php file to get it to omit the body content: // search titles … Read more