Skip to content

Conversation

@gziolo
Copy link
Owner

@gziolo gziolo commented Oct 20, 2025

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

Follow-up for WordPress#9410.

There is also a new REST API endpoint for Ability Categories that I put into this separate PR for transparency.

I transferred it from the Abilities API repository, updating the code based on the feedback in WordPress#9410. Example paths:

GET /wp/v2/ability-categories - all ability categories
GET /wp/v2/ability-categories/test-data-retrieval - a single ability category

The name of the controller: WP_REST_Ability_Categories_Controller.

It's very similar in every aspect to the endpoint for listing abilities.


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.

gziolo and others added 24 commits October 19, 2025 19:58
@gziolo gziolo self-assigned this Oct 20, 2025
@github-actions
Copy link

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

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new REST API endpoint for Ability Categories as part of the WordPress Abilities API. It introduces a controller that provides read-only access to ability categories via the /wp/v2/ability-categories endpoint, supporting both collection listing and individual category retrieval.

Key changes include:

  • New REST controller for ability categories with pagination support
  • Registration of the controller in the WordPress REST API system
  • Comprehensive test coverage for the new endpoint

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/phpunit/tests/rest-api/wpRestAbilityCategoriesController.php Complete test suite covering all REST API endpoints, permissions, pagination, and error handling
src/wp-settings.php Includes the new controller class file in WordPress core
src/wp-includes/rest-api/endpoints/class-wp-rest-ability-categories-controller.php Main controller implementation with collection and item endpoints
src/wp-includes/rest-api.php Registers the controller routes during REST API initialization
src/wp-includes/abilities-api/class-wp-ability.php Updates @subpackage documentation formatting
src/wp-includes/abilities-api/class-wp-ability-category.php Updates @subpackage documentation formatting
src/wp-includes/abilities-api/class-wp-ability-categories-registry.php Updates @subpackage documentation formatting
src/wp-includes/abilities-api/class-wp-abilities-registry.php Updates @subpackage documentation formatting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gziolo
Copy link
Owner Author

gziolo commented Oct 20, 2025

I opened WordPress#10354 with all changes tested against WordPress trunk, and CI checks pass after adding a few tweaks to unit tests setup with 895bb88.

Screenshot 2025-10-20 at 13 41 13

@gziolo gziolo force-pushed the try/abilities-api branch 4 times, most recently from 3d2c27a to 88b4a6f Compare October 21, 2025 13:33
@gziolo
Copy link
Owner Author

gziolo commented Oct 22, 2025

Superseeded by WordPress#10380 and commited with 871fd0e.

@gziolo gziolo closed this Oct 22, 2025
@gziolo gziolo deleted the add/ability-categories-endpoint branch October 22, 2025 07:27
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.

2 participants