Support

Account

Forum Replies Created

  • Well I figured it out but I had to add remove_all_filters('posts_orderby'); before the $args and had to change order to DESC because remove filters reversed the order. Something odd is happening but if someone has an explaination as to why this works please let me know.

    remove_all_filters('posts_orderby');
    
    $args = array (
        'post_type' => 'exhibitions',
        'meta_query'=> array(
            'relation'      => 'AND',
            array(
                'key'       => 'exhibition_status',
                'value'     => 'current',
            ),
            array(
                'key'       => 'end_date',
                'compare'   => 'EXISTS',
            ), 
        ),
        'meta_key'    => 'end_date',
        'orderby'     => 'meta_value',
        'order'       => 'DESC',
        'post_status' => 'publish',
        'posts_per_page' => 10,
        'paged' => get_query_var( 'paged' ),
    );
Viewing 1 post (of 1 total)