src/class-extended-cpt-admin.php
public function default_sort() {

		if ( self::get_current_post_type() !== $this->cpt->post_type ) {
			return;
		}

		# If we've already ordered the screen, bail out:
		if ( isset( $_GET['orderby'] ) ) {
			return;
		}

		# Loop over our columns to find the default sort column (if there is one):
		foreach ( $this->args['admin_cols'] as $id => $col ) {
			if ( is_array( $col ) && isset( $col['default'] ) ) {
				$_GET['orderby'] = $id;
				$_GET['order']   = ( 'desc' === strtolower( $col['default'] ) ? 'desc' : 'asc' );
				break;
			}
		}

	}
public function default_sort() {

		if ( self::get_current_post_type() !== $this->cpt->post_type ) {
			return;
		}

		# If we've already ordered the screen, bail out:
		if ( isset( $_GET['orderby'] ) ) {
			return;
		}

		# Loop over our columns to find the default sort column (if there is one):
		foreach ( $this->args['admin_cols'] as $id => $col ) {
			if ( is_array( $col ) && isset( $col['default'] ) ) {
				$_GET['orderby'] = $id;
				$_GET['order']   = ( 'desc' === strtolower( $col['default'] ) ? 'desc' : 'asc' );
				break;
			}
		}

	}
public function default_sort ( ) { if ( self :: get_current_post_type ( ) !== $ this -> cpt -> post_type ) { return ; } # If we've already ordered the screen, bail out: if ( isset ( $ _GET [ 'orderby' ] ) ) { return ; } # Loop over our columns to find the default sort column (if there is one): foreach ( $ this -> args [ 'admin_cols' ] as $ id => $ col ) { if ( is_array ( $ col ) && isset ( $ col [ 'default' ] ) ) { $ _GET [ 'orderby' ] = $ id ; $ _GET [ 'order' ] = ( 'desc' === strtolower ( $ col [ 'default' ] ) ? 'desc' : 'asc' ) ; break ; } } }
Set the default sort field and sort order on our post type admin screen.
Set the default sort field and sort order on our post type admin screen .