Simple logic OR in $wpdb query
-
My live search only finds results in the post Content OR the Post Titles.
If I take the post_content on the first Place in my Code (like it is now), its finding results in the Content. When I take post_title on the First Place it only searches my typed Words in the Title.
My Question: How should I write the code if I want it to search in my post Content AND Post Titles?$query = " SELECT $wpdb->posts.ID FROM $wpdb->posts WHERE ((post_content LIKE '%%%s%%') OR (post_title LIKE '%%%s%%') AND post_status='publish' AND post_type='".$post_type."' $excludes $order_results LIMIT 0, %d";
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Simple logic OR in $wpdb query’ is closed to new replies.