Support

Account

Home Forums General Issues Order custom posts by date picker field by $_GET query and by post_date Reply To: Order custom posts by date picker field by $_GET query and by post_date

  • Well, that’s hard to say, and I don’t know exactly by looking at what you have.

    You need to add a meta query with a clause and you need to add orderby in the format shown.

    these are just some guesses, you’ll need to test. I’d have to build an entire site to test it myself

    
    $query->set('meta_query', array(
     'date_clause' => array(
        'key' => 'text_date'
        'compare' => 'EXISTS'
      }
    ));
    
    $query->set('orderby',  array(
      'date_clause' => 'DESC',
      'post_date' => 'DESC'
    ));