Include the category name/subcategory name and the tag name inside the search query wordpress/php

I need your help with the search query in wordpress. I need to extend it to be able to search inside the category name, and tag name.

I have to tell the search function to search only inside the:

Read More
  • post
  • title
  • description
  • inside the category tags
  • inside the tags that the question is having

Currently the search function is searching:

  • post
  • title
  • description

and I don’t know why it is not searching and is not returning the category that the question is and the question tags.

For example, if I will look for “installment loan USDA dti” I want to get the question as a result.

  • USDA – is the category that the question belongs to
  • dti – is one of the tags that the question is having.

If I type in the search USDA I should receive all the questions that are in USDA category.
If I type dti I should receive all the questions that have a dti tag.
If I type “installment loan USDA dti” I should get the question that has the installment loan keyword, USDA category, and dti tag.

I was testing today what is on this link:
http://vzurczak.wordpress.com/2013/06/15/extend-the-default-wordpress-search/
That function is working good, but is limited to searching only the tags and keywords.

  1. That code is not searching inside categories.
  2. If I type borrower’s in search result is not returning anything. But if I don’t have that code I am getting the question that has borrower’s in the content. I think the code is buggy a little because it is not able to search for the apostrophe sign.
    I don’t know if that code will help or not. The file I had to change was function.php from the template file.

I also tried the “search everything” plugin, but it is not working.

Related posts

Leave a Reply