[wp-trac] [WordPress Trac] #61152: Pass the full $args array to hook 'get_categories_taxonomy' and allow modification (was: Change Request: Please pass the full $args array to hook 'get_categories_taxonomy' and allow modification)

WordPress Trac noreply at wordpress.org
Mon May 6 14:11:51 UTC 2024


#61152: Pass the full $args array to hook 'get_categories_taxonomy' and allow
modification
-------------------------+------------------------------
 Reporter:  beargfr      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Taxonomy     |     Version:  6.5
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Old description:

> 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.

New description:

 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.

--

Comment (by 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 [https://developer.wordpress.org/reference/hooks/get_terms_args/
 `get_terms_args`] filter. Does that filter cover your use case?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61152#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list