Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
array(
  'taxonomy' => $taxonomy_array_value,          
  'field' => 'slug',
  'terms' => array( $term_name )
)

This is my code where $taxonomy_array_value and $term_name are variables coming from ajax.

First Case :
$taxonomy_array_value = Colors and $term_name = 'red' then WP_Query is working fine.

Second Case :
$taxonomy_array_value = Colors and %term_name = 'red','green' but in this case it's not working.

While instead of using variable if I direct pass 'red','green' in 'terms' then it's working fine but not working with variable Don't know why.

Here is my code from which I am getting $term_name

$term_name = "'" . implode("','", $term_value_array) . "'";
share|improve this question
    
Please reformat your question. Thanks. –  kaiser May 26 '13 at 12:49
add comment

1 Answer 1

up vote 1 down vote accepted

Try

'terms' => $term_value_array

instead of

'terms' => array( $term_name )

It looks like the problem is that you use array("'red','green'") instead of the array structure: array('red','green') that you want.

share|improve this answer
    
Thanks for answer and you know what I already did it before your answer and another thing that you answered in my one other question Thanks for that Thankyou so much. –  Bhuvnesh Gupta May 26 '13 at 12:24
    
great to hear it worked out for you, good luck with your project. –  birgire May 26 '13 at 12:28
add comment

Your Answer

 
discard

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.