🤖 Experiment: Add filtering capabilities to WordPress Abilities API #63
+804
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an AI-generated experiment.
It's mostly to start the conversation using another source of input.
This PR implements comprehensive filtering functionality for the WordPress Abilities API to address the challenge of managing large numbers of registered abilities from core and plugins.
What's New
Core Filtering System
WP_Abilities_Query
class: Provides a WordPress-style query interface for filtering abilitieswp_get_abilities()
function: Now accepts optional query parameters while maintaining full backward compatibilityFiltering Options Available
Namespace filtering: Filter abilities by plugin/namespace prefix
Text search: Search abilities by label or description (case-insensitive)
Schema presence filtering: Filter by input/output schema availability
Meta query filtering: WordPress-style meta queries with multiple operators
Combined filtering: All filters can be used together
REST API Integration
The REST API now supports all filtering options via query parameters:
Backward Compatibility
The changes are fully backward compatible:
wp_get_abilities()
without parameters continues to return all abilitiesImplementation Details
This implementation follows WordPress conventions (similar to
WP_Query
,WP_User_Query
) and provides the scalability needed for managing abilities in environments with many registered items.Fixes #38.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.