WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#40551 closed defect (bug) (duplicate)

Filter get_terms_args order and orderby are not taken into account in get_terms() function

Reported by: michielve Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.4
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

Args orderby and order are taken directly from $this->query_vars instead of $args, so when you specify the get_terms_args filter and change the order and orderby args, they are not taken into account in the get_terms() function.

In line 308:

$args = $this->query_vars;

But in line 391:

$_orderby = $this->query_vars['orderby'];

And in line 401:

$order = $this->parse_order( $this->query_vars['order'] );

Change History (2)

#1 @michielve
2 years ago

I was too fast, I meant the get_terms function in the following file:

https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/class-wp-term-query.php#L304

#2 @boonebgorges
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @michielve - Thank you very much for your ticket and your patch, and welcome to WordPress Trac! Apologies for the delay in the reply.

This appears to be a duplicate of the issue reported in #39354 and fixed in [39625]. If you're able to reproduce your issue in WP 4.8, please feel free to reopen with details.

Note: See TracTickets for help on using tickets.