Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Searching for custom group fields?

@timrourke

Participant

Shane,

As always, you’re super helpful! I’m almost there now.

http://pastebin.com/1xXw9rd9

One thing I still can’t figure out, however, is how to properly get my search string data into the meta query argument. This is what I have currently:

 $gbgd_bpgf_querystring['meta_query'] = array(
    	'relation' => 'OR',
        array(
            'key'     => 'group-custom-field-zip',
            'value'   => $gbgd_bpgf_querystring["search_terms"],
            'type'    => 'numeric',
            'compare' => 'LIKE'
        )
    );

This doesn’t return any results. However, if I type the value for the above key directly into the array, for example I type:

$gbgd_bpgf_querystring['meta_query'] = array(
    	'relation' => 'OR',
        array(
            'key'     => 'group-custom-field-zip',
            'value'   => 12345,
            'type'    => 'numeric',
            'compare' => 'LIKE'
        )
 );

I’m able to get results. Any idea what I’m doing wrong here? I’ve var_dumped my values out to make sure they’re equivalent, tried typecasting the value to an int, etc.

BTW, in case it wasn’t obvious, I’m not using an option/select menu, but trying to grab search queries entered on the groups page.

Thanks!

Skip to toolbar