0

I found several posts about it. Others said that you cannot do it without a plugin and others that it is possible. However, I am not sure what is true :P

This is my query and unfortunately, I cannot make it return objects with a certain tag.

<?php
global $query_string;

$query_args = explode("&", $query_string);
$search_query = array();

foreach($query_args as $key => $string) {
    $query_split = explode("=", $string);
    $search_query[$query_split[0]] = urldecode($query_split[1]);
}

$search = new WP_Query($search_query);
?>

Any idea how I can modify the query to include also the tags without a plugin?

1

This solution may work for you also Include custom taxonomy term in search

  • Unfortunately, this is not what I am asking. What you suggest is to have a query in the format of /?s=keyword&tag=tagexample...However, I have a simple search form with the query /?s=keyword..I want to search for this keyword, both in titles, contents and tags. – Tasos Nov 13 '15 at 8:58
  • Sorry, I didn't understand your post correctly. Maybe this solution will fit your nees wordpress.stackexchange.com/questions/2623/… – ville6000 Nov 13 '15 at 9:14
  • This seems that works from the first check. Give me some time to test it thoroughly and till then, please update your answer so I can accept it if it really works. – Tasos Nov 13 '15 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.