fix(docs): Correct invalid function references and parameter placement in documentation #140
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.
Description
This PR fixes critical documentation errors that would cause developers to write incorrect code when implementing the Abilities API.
Changes Made
1. ✅ Fixed Invalid Function Reference
File:
docs/rest-api.md(line 14)Before:
After:
Reason: The function
wp_execute_ability()does not exist in the codebase. Verified by searching all files inincludes/directory. The correct pattern is documented inincludes/abilities-api/class-wp-ability.phpat line 595.2. ✅ Fixed Incorrect Parameter Placement
Files:
docs/getting-started.md(lines 110-127)docs/hooks.md(lines 72-91)Before:
After:
Reason: According to the function signature in
includes/abilities-api.php(line 237),categoryis a required top-level parameter, not part of themetaarray. This is confirmed by the core implementation inincludes/abilities/wp-core-abilities.php(line 89).3. ✅ Fixed Incorrect Class Name
File:
docs/hooks.md(line 26)Before:
After:
Reason: The actual class name is
WP_Ability_Categories_Registryas defined inincludes/abilities-api/class-wp-ability-categories-registry.php(line 18).Verification
Function Existence Check
All available global functions in
includes/abilities-api.php:wp_register_ability()- line 278wp_unregister_ability()- line 324wp_has_ability()- line 357wp_get_ability()- line 389wp_get_abilities()- line 419wp_register_ability_category()- line 467wp_unregister_ability_category()- line 512wp_has_ability_category()- line 544wp_get_ability_category()- line 576wp_get_ability_categories()- line 607wp_execute_ability()- DOES NOT EXISTParameter Structure Check
Verified against:
includes/abilities-api.php(lines 232-277)includes/abilities/wp-core-abilities.php(lines 87-143)includes/abilities-api/class-wp-ability.php(lines 213-260)Impact
Before This PR ❌
Developers following the documentation would:
wp_execute_ability()categoryin wrong locationAfter This PR ✅
Developers can:
wp_get_ability()and$ability->execute()Testing
Checklist
Fixes: #139