0

I have a custom field, which its value is an wp array..

and I am trying to get the posts filtering by this custom field, the problem is that the value its an array and my code its not working..

here it is the last try:

$args = array(
            'orderby' => 'title', 
            'post_type' => 'need', 
            'meta_key' =>'institution',
            'meta_value'=>  '.$institutionId.');

        $donations = get_posts($args);

I've tried meta_query too but it didn't work too :(

edited:

I've archived the solution I've wanted to. but I can answer my question now.. so i will post the answer when I'll be able too

3
  • how could the value retrieved from DB be an array ? Commented Dec 20, 2011 at 19:56
  • I don't know if I made myself clear but the meta_value of the meta_key institution is an array... so I think the problem is there.. since i wasn't the one who made the structure, i can't change it... :( Commented Dec 20, 2011 at 19:58
  • 1
    you need to remove the '. and .' around $institutionId. Try print_r($args) and make sure the data looks correct before you call get_posts Commented Dec 20, 2011 at 20:49

1 Answer 1

1

Try replacing '.$institutionId.' with $institutionId or $institutionId[0]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.