1

I just realized in testing, it appears worpress search is not matching my search term "php" with any post's tagged with "php" or in a category of "php" unless php is in the title or body, is that all the search searches for?

1 Answer 1

4

yes, WordPress search only searches title or post content. There are a few plugins that extend search to taxonomies, Relevanssi is one.

EDIT - The query WordPress produces for default search:

SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID
FROM wp_posts  WHERE 1=1
AND (((wp_posts.post_title LIKE '%test%')
OR (wp_posts.post_content LIKE '%test%')))
AND wp_posts.post_type IN ('post', 'page', 'attachment')
AND (wp_posts.post_status = 'publish'
OR wp_posts.post_author = 1
AND wp_posts.post_status = 'private')
ORDER BY wp_posts.post_date DESC
LIMIT 0, 10
5
  • thanks, ill just have to remember to include the tags/category term somewhere in the content
    – JasonDavis
    Oct 10, 2011 at 17:18
  • I think what @Milo says is not correct. Default search can search taxonomies and custom fields. Check this analysis here: gist.github.com/2023628
    – p.a.
    Sep 21, 2012 at 7:36
  • @p.a. - you can obviously query taxonomies and custom fields but the actual query WordPress performs when you do a search does not include those things. see edit above for SQL WordPress produces when you perform a search.
    – Milo
    Sep 21, 2012 at 14:18
  • @Milo I lost you; can Wordpress search for custom taxonomies and custom fields via Wp-Query or not? This is important for my dev plans. Thanks
    – p.a.
    Sep 21, 2012 at 19:09
  • @p.a. - you can't do a full pattern match search of everything simultaneously without directly modifying the query via filters like posts_join and posts_where
    – Milo
    Sep 21, 2012 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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