Issue with Sorting Posts by Views Using Advanced OrderBy Options
-
I was trying to sort my posts by views using the “Advanced OrderBy Options” -> “Dynamic OrderBy Field” -> “value”, but the sorting was coming out wrong (e.g., 9, 89, 7, 123 instead of 123, 89, 9, 7). After some troubleshooting, I realized that in the plugin’s
queries.phpfile, the order was being set withmeta_value. Once I changed it tometa_value_num, it worked perfectly.Can you please address this in your next update? Thank you!
if( in_array( 'dynamic_orderby', $advanced_options ) ){ if( $settings[ 'advanced_orderby_options' ] == 'dynamic_orderby' ){ $query_vars[ 'meta_key' ] = $settings[ 'dynamic_orderby_options' ]; $query_vars[ 'orderby' ] = 'meta_value_num'; }
The topic ‘Issue with Sorting Posts by Views Using Advanced OrderBy Options’ is closed to new replies.