Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

BainternetBainternet assisted me earlerearler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the same key the query fails. Is there a way to use an array in the value?Something similar to.

'value' => array( 'Install Manual', 'User Manual' ),

I've searched quite a bit with no results. This is where I'm at so far.

$documents = array(
    'post_type' => 'documents',
    'meta_query' => array(
    'relation' => 'AND',
        array(
            'key' => 'document-type',
            'value' => array( 'Install Manual', 'User Manual' ),
        ),
       array(
            'key' => 'document-status',
            'value' => 'current',
        )
    )
);
query_posts( $documents );
get_template_part( 'loop', 'documents' );
wp_reset_query();

Bainternet assisted me earler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the same key the query fails. Is there a way to use an array in the value?Something similar to.

'value' => array( 'Install Manual', 'User Manual' ),

I've searched quite a bit with no results. This is where I'm at so far.

$documents = array(
    'post_type' => 'documents',
    'meta_query' => array(
    'relation' => 'AND',
        array(
            'key' => 'document-type',
            'value' => array( 'Install Manual', 'User Manual' ),
        ),
       array(
            'key' => 'document-status',
            'value' => 'current',
        )
    )
);
query_posts( $documents );
get_template_part( 'loop', 'documents' );
wp_reset_query();

Bainternet assisted me earler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the same key the query fails. Is there a way to use an array in the value?Something similar to.

'value' => array( 'Install Manual', 'User Manual' ),

I've searched quite a bit with no results. This is where I'm at so far.

$documents = array(
    'post_type' => 'documents',
    'meta_query' => array(
    'relation' => 'AND',
        array(
            'key' => 'document-type',
            'value' => array( 'Install Manual', 'User Manual' ),
        ),
       array(
            'key' => 'document-status',
            'value' => 'current',
        )
    )
);
query_posts( $documents );
get_template_part( 'loop', 'documents' );
wp_reset_query();
edited title
Link
Zach Shallbetter
  • 1.2k
  • 7
  • 22
  • 45

Querying multiple values for afrom a single key

Source Link
Zach Shallbetter
  • 1.2k
  • 7
  • 22
  • 45

Querying multiple values for a a single key

Bainternet assisted me earler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the same key the query fails. Is there a way to use an array in the value?Something similar to.

'value' => array( 'Install Manual', 'User Manual' ),

I've searched quite a bit with no results. This is where I'm at so far.

$documents = array(
    'post_type' => 'documents',
    'meta_query' => array(
    'relation' => 'AND',
        array(
            'key' => 'document-type',
            'value' => array( 'Install Manual', 'User Manual' ),
        ),
       array(
            'key' => 'document-status',
            'value' => 'current',
        )
    )
);
query_posts( $documents );
get_template_part( 'loop', 'documents' );
wp_reset_query();