Answers for "wc_order_query meta query"

PHP
0

order by meta_query wordpress

$q = new WP_Query( 
    array(
        'meta_key' => 'population', //setting the meta_key which will be used to order
        'orderby' => 'meta_value', //if the meta_key (population) is numeric use meta_value_num instead
        'order' => 'DESC', //setting order direction
        'meta_query' => array(
            'relation' => 'AND', //setting relation between queries group
            array(
                'relation' => 'OR', //setting relation between this inside query
                array(
                    'key' => 'state',
                    'value' => 'Wisconsin',
                ),
                array(
                    'key' => 'timezone',
                    'value' => 'central',
                )
            ),
            array(
                'key' => 'city',
                'compare' => 'EXISTS',
            )
        )
    )           
);
Posted by: Guest on November-15-2020
0

wc_order_query meta query

$q = new WP_Query( 
    array(
        'meta_key' => 'population', //setting the meta_key which will be used to order
        'orderby' => 'meta_value', //if the meta_key (population) is numeric use meta_value_num instead
        'order' => 'DESC', //setting order direction
        'meta_query' => array(
            'relation' => 'AND', //setting relation between queries group
            array(
                'relation' => 'OR', //setting relation between this inside query
                array(
                    'key' => 'state',
                    'value' => 'Wisconsin',
                ),
                array(
                    'key' => 'timezone',
                    'value' => 'central',
                )
            ),
            array(
                'key' => 'city',
                'compare' => 'EXISTS',
            )
        )
    )           
);
Posted by: Taylor Swift on March-10-2022

Browse Popular Code Answers by Language