People, tell me ... Forgot not much, how to write requests correctly ...

SELECT `post_title`,`id` FROM `{$wpdb->prefix}posts` WHERE `post_title` LIKE '%{$searcher}%' or `post_content` LIKE '%{$searcher}%' and `post_status` = 'publish' 

For some reason, the condition "and" is not satisfied in this request. I encountered such a problem already, but I don’t remember how it was solved ... It seems like quotation marks should be put somewhere or something else ...

    1 answer 1

    Thank you, already figured out ...

     SELECT post_title,id FROM {$wpdb->prefix}posts WHERE (post_title LIKE '%{$searcher}%' or post_content LIKE '%{$searcher}%') and post_status = 'publish' 

    Brackets missed :(