Skip to content

Commit

Permalink
Merge pull request #4 from rubendelblanco/checkIfOrderByIsArray
Browse files Browse the repository at this point in the history
fix:check if $orderby is not an array
  • Loading branch information
Mte90 authored Aug 21, 2023
2 parents c1a206a + 56b38c4 commit d711b9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CPT_Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function _column_orderby( $query ) {
}

$orderby = $query->get( 'orderby' );
if ( (!empty( $orderby ) && isset( $this->cpt_sortable_columns[ $orderby ], $this->cpt_sortable_columns[ $orderby ][ 'type' ] )) && $this->cpt_sortable_columns[ $orderby ][ 'type' ] === 'custom_value' ) {
if ( !is_array( $orderby ) && (!empty( $orderby ) && isset( $this->cpt_sortable_columns[ $orderby ], $this->cpt_sortable_columns[ $orderby ][ 'type' ] )) && $this->cpt_sortable_columns[ $orderby ][ 'type' ] === 'custom_value' ) {
$query->set( 'orderby', 'meta_value' );
//$query->set( 'meta_key', $this->cpt_sortable_columns[ $orderby ][ 'meta_key' ] );
$query->set( 'meta_query', array(
Expand Down

0 comments on commit d711b9d

Please sign in to comment.