ordering fallback
This commit is contained in:
parent
3697f5104a
commit
b64fad99f5
|
@ -96,8 +96,9 @@ function wc_terms_clauses( $clauses, $taxonomies, $args ) {
|
|||
|
||||
// For sorting, force left join in case order meta is missing.
|
||||
if ( ! empty( $args['force_menu_order_sort'] ) ) {
|
||||
$clauses['join'] = str_replace( "INNER JOIN {$wpdb->termmeta} ON ( t.term_id = wp_termmeta.term_id )", "LEFT JOIN {$wpdb->termmeta} ON ( t.term_id = {$wpdb->termmeta}.term_id AND {$wpdb->termmeta}.meta_key='order')", $clauses['join'] );
|
||||
$clauses['where'] = str_replace( "{$wpdb->termmeta}.meta_key = 'order'", "{$wpdb->termmeta}.meta_key = 'order' OR {$wpdb->termmeta}.meta_key IS NULL", $clauses['where'] );
|
||||
$clauses['join'] = str_replace( "INNER JOIN {$wpdb->termmeta} ON ( t.term_id = wp_termmeta.term_id )", "LEFT JOIN {$wpdb->termmeta} ON ( t.term_id = {$wpdb->termmeta}.term_id AND {$wpdb->termmeta}.meta_key='order')", $clauses['join'] );
|
||||
$clauses['where'] = str_replace( "{$wpdb->termmeta}.meta_key = 'order'", "{$wpdb->termmeta}.meta_key = 'order' OR {$wpdb->termmeta}.meta_key IS NULL", $clauses['where'] );
|
||||
$clauses['orderby'] .= ', t.name';
|
||||
}
|
||||
|
||||
return $clauses;
|
||||
|
|
Loading…
Reference in New Issue