60 posts High Quality Themes
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+2 more
HighThemes says

Hi mates. I simply want to include a custom field in search results.

for example the search term is “lorem ipsum”. Wordpress by default just compares it with title & content. I want it to compare it with a custom field as well.

I googled a lot but no result!

Thanks

1148 posts
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
fillerspace says

WordPress search is just passing parameters to WP_query (http://codex.wordpress.org/Function_Reference/WP_Query). You can pass additional parameters and construct your own WP_query. For custom posts, I believe meta_value= should do the trick.

$search_query = new WP_Query('meta_value='.$search);
2459 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $100+ on Envato Market
  • Has referred 100+ members
  • Has been a beta tester for an Envato feature
+3 more
digitalimpact says

This should get you on the right track : http://sixrevisions.com/wordpress/custom-fields-search/

60 posts High Quality Themes
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+2 more
HighThemes says
by
by
by
by
by
by