Skip to content

Commit

Permalink
Exempt requests that include a post arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Nov 21, 2024
1 parent 5d6b597 commit ce5cef8
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,16 @@ public function get_items( $request ) {
/*
* When a taxonomy is registered with an 'args' array,
* those params override the `$args` passed to this function.
*
* We only need to do this if no `post` argument is provided.
* Otherwise, terms will be fetched using `wp_get_object_terms()`,
* which respects the default query arguments set for the taxonomy.
*/
if ( isset( $taxonomy_obj->args ) && is_array( $taxonomy_obj->args ) ) {
if (
empty( $prepared_args['post'] ) &&
isset( $taxonomy_obj->args ) &&
is_array( $taxonomy_obj->args )
) {
$prepared_args = array_merge( $prepared_args, $taxonomy_obj->args );
}

Expand Down

0 comments on commit ce5cef8

Please sign in to comment.