Repository navigation
Abilities API: Add the core/terms-query ability - #16102
jorgefilipecosta wants to merge 1 commit into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
b5772b3 to
a53d52a
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
gziolo
left a comment
There was a problem hiding this comment.
Thank you for working on this! I finished my review of core/terms-query and left my comments inline. Thank you also for the quick fix for the slugs.
I recommend splitting this PR. It could keep core/terms-query together with the show_in_abilities argument for taxonomies. The core/term-create, core/term-update and core/term-delete abilities could move to a follow-up PR. This is the process we followed in the WordPress 7.2 cycle, where the read abilities landed first. This way the read part can land much faster, before the writes.
For the query, the two comments that matter most to me are the totals with hide_empty and the post types accepted by where.post. The other comments are low priority.
db3e1d9 to
58bcc4a
Compare
This comment has been minimized.
This comment has been minimized.
c9b6c57 to
f9ed329
Compare
Adds `core/terms-query`, which lists the terms of a taxonomy exposed to abilities, and the `show_in_abilities` argument of `register_taxonomy()`, `true` for `category` and `post_tag`. See #66743.
f9ed329 to
5489b28
Compare
core/terms-query, core/term-create, core/term-update and core/term-delete abilitiescore/terms-query ability
Shape from WordPress/abilities#22. Same approach as #16028.
This PR adds the
core/terms-queryability to thecontentcategory, for the taxonomies that setshow_in_abilities:core/terms-querytakes{ where, fields, pagination }and returns{ items, pagination }with the totals.where.taxonomyis required, andids,slugs,parent,postandhide_emptyfilter the terms.where.post, the user must be able to read the post.As suggested in review,
core/term-create,core/term-updateandcore/term-deletemoved to their own PR, stacked on this one: #16409Outside the new
WP_Abilities_Termsclass:register_taxonomy()accepts a newshow_in_abilitiesargument, stored inWP_Taxonomy::$show_in_abilities. It isfalseby default andtrueforcategoryandpost_tag.wp_register_core_abilities()loads the class and registers the ability.Querying the top-level categories, two per page:
{ "items": [ { "id": 2, "name": "News", "slug": "news", "count": 1 }, { "id": 5, "name": "Product updates", "slug": "updates", "count": 0 } ], "pagination": { "total": 3, "total_pages": 2 } }Trac ticket: https://core.trac.wordpress.org/ticket/66743
Testing
Verify unit tests are passing:
Or run the example above in the editor console as a logged-in user.
AI disclosure: the change and tests were drafted with AI assistance (Claude Code).