mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Fix orderby meta handling for WP_Term_Query.
In order to allow meta-related values of `orderby` to be handled properly, the term query's `meta_query` object must run its `get_sql()` method before `orderby` parsing. Fixing this bug required addressing another bug in `WP_Meta_Query`, which caused the table alias index not to be reset when calling `get_sql()` multiple times on the same object. Props littler.chicken. Fixes #37151. git-svn-id: https://develop.svn.wordpress.org/trunk@37860 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -814,6 +814,8 @@ class WP_Term_Query {
|
||||
protected function parse_orderby_meta( $orderby_raw ) {
|
||||
$orderby = '';
|
||||
|
||||
// Tell the meta query to generate its SQL, so we have access to table aliases.
|
||||
$this->meta_query->get_sql( 'term', 't', 'term_id' );
|
||||
$meta_clauses = $this->meta_query->get_clauses();
|
||||
if ( ! $meta_clauses || ! $orderby_raw ) {
|
||||
return $orderby;
|
||||
|
||||
Reference in New Issue
Block a user