Skip to content

Commit

Permalink
Skip filter if a post is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Nov 21, 2024
1 parent 5e22ffa commit d156b98
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/compat/wordpress-6.8/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ function gutenberg_add_post_type_rendering_mode() {
// When querying terms for a given taxonomy in the REST API, respect the default
// query arguments set for that taxonomy upon registration.
function gutenberg_respect_taxonomy_default_args_in_rest_api( $args ) {
// If a `post` argument is provided, the Terms controller will use
// `wp_get_object_terms`, which respects the default query arguments,
// so we don't need to do anything.
if ( ! empty( $args['post'] ) ) {
return $args;
}

$t = get_taxonomy( $args['taxonomy'] );
if ( isset( $t->args ) && is_array( $t->args ) ) {
$args = array_merge( $args, $t->args );
Expand Down

0 comments on commit d156b98

Please sign in to comment.