This repository was archived by the owner on Feb 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
docs: add installation steps for release #48
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,93 @@ | ||
| # 2. Getting Started | ||
|
|
||
| ## Installation Options | ||
| ## Installation | ||
|
|
||
| Currently, the Abilities API is available as a WordPress plugin. You can install it by cloning the repository into your `wp-content/plugins` directory. | ||
| Until the Abilities API is merged into WordPress core, it must be installed before it can be used. | ||
|
|
||
| ### As a plugin | ||
|
|
||
| The easiest way to try and use the Abilities API is to install it as a plugin by downloading the latest release from the [GitHub Releases page](https://github.com/WordPress/abilities-api/releases/latest). | ||
|
|
||
| #### With WP-CLI | ||
|
|
||
| ```bash | ||
| cd wp-content/plugins | ||
| git clone https://github.com/WordPress/abilities-api | ||
| wp plugin install https://github.com/WordPress/abilities-api/releases/latest/download/abilities-api.zip | ||
| ``` | ||
|
|
||
| #### With WP-Env | ||
|
|
||
| ```jsonc | ||
| // .wp-env.json | ||
| { | ||
| "$schema": "https://schemas.wp.org/trunk/wp-env.json", | ||
| // ... other config ... | ||
| "plugins": [ | ||
| "WordPress/abilities-api", | ||
| // ... other plugins ... | ||
| ], | ||
| // ... more config ... | ||
| } | ||
| ``` | ||
|
|
||
| ### As a dependency | ||
|
|
||
| Plugin authors and developers may wish to rely on the Abilities API as a dependency in their own projects, before it is merged into core. You can do that in one of the following ways. | ||
|
|
||
| #### As a Plugin Dependency (Recommended) | ||
|
|
||
| The best way to ensure the Abilities API is available for your plugins is to include it as one of your `Requires Plugins` in your [Plugin header](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/). For example: | ||
|
|
||
| ```diff | ||
| # my-plugin.php | ||
| /* | ||
| * | ||
| * Plugin Name: My Plugin | ||
| * Plugin URI: https://example.com/plugins/the-basics/ | ||
| * Description: Handle the basics with this plugin. | ||
| * {all the other plugin header fields...} | ||
| + * Requires Plugins: abilities-api | ||
|
justlevine marked this conversation as resolved.
|
||
| */ | ||
| ``` | ||
|
|
||
| While this is enough to ensure the Abilities API is loaded before your plugin, if you need to ensure specific version requirements or provide users guidance on installing the plugin, you can use the methods described [later on](#checking-availability-with-code) | ||
|
|
||
| #### As a Composer dependency | ||
|
|
||
| ```bash | ||
| composer require wordpress/abilities-api | ||
| ``` | ||
|
justlevine marked this conversation as resolved.
|
||
|
|
||
| ### Checking availability with code | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One note on these checks, if the code that's doing the checking is inside of a plugin that loads after wp-abilities-api (eg wp-my-plugin) then this might not work. It's on the lower end of the scale of the realm of possibility, but still possible enough to warrant a note about it. I experienced this recently when setting up my workshop examples after recent updates to the mcp-adapter. |
||
|
|
||
| To ensure the Abilities API is loaded in your plugin: | ||
|
|
||
| ```php | ||
| if ( ! class_exists( 'WP_Ability' ) ) { | ||
| // E.g. add an admin notice about the missing dependency. | ||
| add_action( 'admin_notices', static function() { | ||
| wp_admin_notice( | ||
| // If it's a Composer dependency, you might want to suggest running `composer install` instead. | ||
| esc_html__( 'This plugin requires the Abilities API to use. Please install and activate it.', 'my-plugin' ), | ||
| 'error' | ||
| ); | ||
| } ); | ||
| return; | ||
| } | ||
| ``` | ||
|
|
||
| You can also check for specific versions of the Abilities API using the `WP_ABILITIES_API_VERSION` constant: | ||
|
|
||
| ```php | ||
| if ( ! defined( 'WP_ABILITIES_API_VERSION' ) || version_compare( WP_ABILITIES_API_VERSION, '0.1.0', '<' ) ) { | ||
| // E.g. add an admin notice about the required version. | ||
| add_action( 'admin_notices', static function() { | ||
| wp_admin_notice( | ||
| esc_html__( 'This plugin requires Abilities API version 0.1.0 or higher. Please update the plugin dependency.', 'my-plugin' ), | ||
| 'error' | ||
| ); | ||
| } ); | ||
| return; | ||
| } | ||
| ``` | ||
|
|
||
| ## Basic Usage Example | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we will have a release available soon, because right now this is not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I believe this is the last PR before we cut v0.1.0