Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get posts with multiple meta value in wordpress

$args = array(
    'post_type'  => 'event',
    'meta_query' => array(
        'relation' => 'AND',
        'event_start_date_clause' => array(
            'key'     => '_event_start_date',
            'compare' => 'EXISTS',
        ),
        'event_start_time_clause' => array(
            'key'     => '_event_start_time',
            'compare' => 'EXISTS',
        ), 
    ),
    'orderby' => array(
        'event_start_date_clause' => 'ASC',
        'event_start_time_clause' => 'ASC',
    ),
);
Source by developer.wordpress.org #
 
PREVIOUS NEXT
Tagged: #posts #multiple #meta #wordpress
ADD COMMENT
Topic
Name
6+3 =