I've got a custom area with meta_title is product_id. I'm attempting to figure out how to look that area while using the wordpress search.

I understand the wordpress search engine results page uses query_string which consists of the "s" value for that keyword looked I simply don't understand how to change my code below to look the custom area pointed out.

$loop = new WP_Query("$query_string . '&posts_per_page=-1&post_type=product'"); ?> 

think this within the codex must have the solutions you'll need in relation to including custom area parameters for you query:


Unsure whether that will help you to search inside a particular custom area though. Can not be certain however i think you'd need to make some changes around the search form finish of things. Observe how you continue including the custom area parameters.

Off the top my mind I'd think you'd need something similar to:

$query = new WP_Query( array( 
    'meta_key' => 'product_id', 
    'meta_value' => $query_string,
    'posts_per_page' => '-1',
    'post_type' => 'product' 
) );

Not examined though!