Support

Account

Home Forums Backend Issues (wp-admin) Sort CPT entries by an ACF field Reply To: Sort CPT entries by an ACF field

  • your need to see if orderby is in the url query. This cannot be done by looking at $query->get( 'orderby'); because by the time of pre_get_posts WP has already set it to the default of date in the admin.

    
    if (empty($_GET['orderby'])) {
      // set default orderby
    }