Query posts by categories and tags using free text search


I’m currently building my own search results page which takes a value from the URL. I’m able to query the post title easily enough by using the S parameter however I’m wondering how I could expend this to also query categories, tags and the maybe the excerpt?

Obviously, as the value is from a text input it’s going to have to be some kind of “LIKE” query.

If someone could point me in the right direction I really appreciated it.

$args = array (
   'post_type' => 'post',
   'post_status' => 'publish',
   's' => $_REQUEST['terms'],
   'posts_per_page' => 12,
   'orderby'     => 'title',
   'order'       => 'ASC'
Carl Youngman 4 months 0 Answers 11 views 0

Leave an answer