Skip to content

Conversation

@aaronjorbin
Copy link
Member

Follow up to https://core.trac.wordpress.org/changeset/61045 and https://core.trac.wordpress.org/changeset/61032

Trac ticket: https://core.trac.wordpress.org/ticket/64098


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

github-actions bot commented Oct 23, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jorbin, jason_the_adams, gziolo, timothyblynjacobs.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@aaronjorbin aaronjorbin requested review from gziolo October 23, 2025 12:49
@github-actions
Copy link

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@gziolo
Copy link
Member

gziolo commented Oct 23, 2025

Is this stricly necessary? I followed the feedback from @TimothyBJacobs (#9410 (comment)) when renaming the route and controller.

@aaronjorbin
Copy link
Member Author

I think so since the name of the resource is ability categories, not categories.

@TimothyBJacobs
Copy link
Member

IMO it being within the wp-abilities/v1 namespace means we don't need to, and shouldn't, duplicate the naming here.

),
'abilities' => array(
'href' => rest_url( sprintf( '%s/abilities?category=%s', $this->namespace, $category->get_slug() ) ),
'href' => rest_url( sprintf( '%s/abilities?ability_category=%s', $this->namespace, $category->get_slug() ) ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this parameter already get changed in another PR? I'm not seeing this change in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should stay as category param here, unless you also want to change the filtering in the list controller.

@aaronjorbin
Copy link
Member Author

My thinking with being specific is that it prevents any confusion between categories and abilities categories. This was what I view as the consensus reached in #9410. While this endpoint is inside the wp-abilities namespace, it's not duplicative since the name is abilities categories not categories. By being consistent and always using the full and accurate name, there is less of a chance to generate confusion.

I think this is important to get right since this isn't something that will be easy to change after 6.9 is released.

@aaronjorbin
Copy link
Member Author

In order for thsi to make RC1, I'm planning to commit this on Monday, please get any reviews folks have in done before them.

Copy link
Member

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's important for us to be consistent with this. 👍

@TimothyBJacobs
Copy link
Member

I think this is important to get right since this isn't something that will be easy to change after 6.9 is released.

Agreed.

My thinking with being specific is that it prevents any confusion between categories and abilities categories.

Adopting a specific namespace for the API allows us to organize like endpoints and reduce duplicative naming. Ultimately, Code is Poetry, and I think APIs like:

/wp-abilities/v1/categories
/wp-abilities/v1/abilities?category=blah

Are more elegant than:

/wp-abilities/v1/ability-cateogires
/wp-abilities/v1/abilities?ability_category=blah

it prevents any confusion between categories and abilities categories

I don't think this is likely to happen. I think the segmentation provided by the namespace and the API structure is pretty different.

@aaronjorbin
Copy link
Member Author

Adopting a specific namespace for the API allows us to organize like endpoints and reduce duplicative naming. Ultimately, Code is Poetry, and I think APIs like:

/wp-abilities/v1/categories
/wp-abilities/v1/abilities?category=blah

Are more elegant than:

/wp-abilities/v1/ability-cateogires
/wp-abilities/v1/abilities?ability_category=blah

The problem is that it's not accurate. These are not categories, they are ability categories. Using a shortened form that is the name of something else doesn't reduce duplicative naming, it makes it inaccurate.

@TimothyBJacobs
Copy link
Member

The argument I understand you to be making, is that the API namespace doesn't matter for naming, and doesn't provide any scoping. I just can't get behind that.

These are not categories, they are ability categories.

I'm struggling to understand what you mean by this. Yes, they are used to categorize abilities. And that should be evident by their URL including "abilities".

Most resources in this API are going to also be about abilities, and I don't want us to need to prefix every one of them with the word ability since it is already described by the namespace.

The mapping of PHP functions doesn't need to be an exact one-to-one with how they are represented in the REST API. We see this in other Core APIs like /wp/v2/types and /wp/v2/statuses. The PHP functions are referring only to "post types" and "post statuses", but they aren't included in the URL.

But even if we do look at the PHP API, we can see that the abilities portion of the symbol is to provide scoping. For example, wp_register_ability() takes a category argument, not an ability_category. The hook to register categories is wp_abilities_api_categories_init not wp_abilities_api_ability_categories_init.

@aaronjorbin
Copy link
Member Author

I'm struggling to understand what you mean by this. Yes, they are used to categorize abilities. And that should be evident by their URL including "abilities".

The consensus decided in #9410 was to name them Abilities Categories with the specific idea being "We always refer to them as Ability Categories and not merely "category"". What I'm hoping to do here is to live up to that consensus.

But even if we do look at the PHP API, we can see that the abilities portion of the symbol is to provide scoping. For example, wp_register_ability() takes a category argument, not an ability_category. The hook to register categories is wp_abilities_api_categories_init not wp_abilities_api_ability_categories_init.

Thanks, I'll open a new PR to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants