Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#61152 closed enhancement (wontfix)

Pass the full $args array to hook 'get_categories_taxonomy' and allow modification

Reported by: beargfr's profile beargfr Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.5
Component: Taxonomy Keywords:
Focuses: Cc:

Description (last modified by swissspidy)

Currently, hook point get_categories_taxonomy only receives single element of the $args array: $args['taxonomy'].

Passing the entire $args array instead would permit modification at that hook point and would make it simple to provide additional function at that point, such as controlling the results of get_categories by setting $args['exclude'], $args['include'] and thus controlling which categories are listed by the things such as category widgets, etc.

Change History (3)

#1 follow-up: @swissspidy
2 years ago

  • Description modified (diff)
  • Summary changed from Change Request: Please pass the full $args array to hook 'get_categories_taxonomy' and allow modification to Pass the full $args array to hook 'get_categories_taxonomy' and allow modification

Hi there and welcome to Trac!

This hook is used in get_categories(), which in turn uses get_terms()/WP_Term_Query. All term queries' arguments can be filtered using the `get_terms_args` filter. Does that filter cover your use case?

#2 in reply to: ↑ 1 @beargfr
2 years ago

Replying to swissspidy:

Hi there and welcome to Trac!

This hook is used in get_categories(), which in turn uses get_terms()/WP_Term_Query. All term queries' arguments can be filtered using the `get_terms_args` filter. Does that filter cover your use case?

Yes! That gave me what I needed. Thanks.

#3 @swissspidy
2 years ago

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

Excellent!

In that case I don't think we need an extra hook, so I am closing this as wontfix.

Note: See TracTickets for help on using tickets.