Support

Account

Home Forums ACF PRO Post object selects are empty Reply To: Post object selects are empty

  • Thanks, John. I amended the function accordingly and this was what I got.

    
    function cpt_date_orderby( $query ) {
     if (!$query->is_main_qieru()) {
      return;
     }
     $orderby = $query->get( 'orderby' );
     if( 'date' == $orderby ) {
        $query->set('meta_key', 'date');
        $query->set('orderby', 'meta_value_num');
     }
    }
    add_action( 'pre_get_posts', 'cpt_date_orderby' );
    

    Did I get it wrong?