• Resolved Doodlebee

    (@doodlebee)


    Hey all,

    I’m updating my plugin, and it’s going well, but I have an issue I’m running into. query_posts has a cool new addition called “meta_query”, and it’s making my fe easier. However, I am running into an issue: I have a field set in the database (called “instructions”) that’s filled with custom metabox info. The stuff put into the filed is an array. That’s not an issue at all – putting that in and taking it out to manipulate it is not an issue.

    My issue is that one of the array keys (within the instructions array) holds an array of values. The other array keys just hold strings. I’m doing a query_post based on what’s not only set within a key (holding a single string), but within a secondary key – the one that holds the array.

    Confused yet? LOL

    my code is this:

    $instruction_query = new WP_Query(array('post_type' => 'instructions', 'post_status' => 'publish',
    'meta_query' => array( 'relation' => 'OR',
    array('key' => 'instructions', 'value' => $pagenow, 'compare' => 'LIKE'),							array('key' => 'multi', 'value' => $pagenow, 'compare' => 'LIKE')
    )
     )
    );

    the “multi” is what holds an array as its value. I can’t seem to get the syntax correct for searching that key-within-a-key. Anyone know how I can do that? I’ve tried making the key “instructions[‘multi’]”, as well as just making the key “instructions” and the value “array(‘multi’ => $pagenow)”, but neither work. (I’ve tried other crazy stuff to no avail as well)

    Anyone have any tips or ideas for me?

Viewing 1 replies (of 1 total)
  • Thread Starter Doodlebee

    (@doodlebee)

    Okay, well, I’ll mark this as “resolved” because after much searching (before and after posting this) it seems what I want isn’t possible. So I’ve found an alternate route to do what I need done. So even though I can’t answer *this* exact question, I did figure out how to do what I needed through different means.

Viewing 1 replies (of 1 total)
  • The topic ‘Search multidimensional array with meta_query()’ is closed to new replies.