WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to filter my posts in categories pages, by showing only posts that have specific WORD in custom field value. I need php code that i should add in loop for this category.

Details: I need loop query that will say - show posts in this category (crocs) only if custom field hey 'brand' contain the same value (crocs). BUT note, in custom field 'brand' i have more brands, for example 'diesel, crocs, fendi'. Now i need post to show if value contains crocs, not if it's equal to crocs (as other brands can be present).

Thanks a lot for your help. Maybe this is basic, but I am noob and trying to learn and understand WP :)

Cheers, Dean

share|improve this question
could i do something like - show posts if cat_title exist in meta_value???: <?php query_posts('meta_key=Brand&meta_value=*single_cat_title();*'); ?> <?php get_template_part( 'loop' , 'entry') ?> – Dean Sep 1 '12 at 4:34
args = array(
    'post_type' => 'product',
    'meta_query' => array(
            'key' => 'brand',
            'value' => 'crocs',
            'compare' => 'LIKE'
$query = new WP_Query( $args );


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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