diff --git a/wp-includes/abilities-api.php b/wp-includes/abilities-api.php index 835bd535d2..73ba658f3f 100644 --- a/wp-includes/abilities-api.php +++ b/wp-includes/abilities-api.php @@ -132,8 +132,7 @@ declare( strict_types = 1 ); * * Ability names must follow these rules: * - * - Contain 2 to 4 segments separated by forward slashes - * (e.g., `my-plugin/my-ability`, `my-plugin/resource/find`, `my-plugin/resource/sub/find`). + * - Include a namespace prefix (e.g., `my-plugin/my-ability`). * - Use only lowercase alphanumeric characters, dashes, and forward slashes. * - Use descriptive, action-oriented names (e.g., `process-payment`, `generate-report`). * @@ -226,8 +225,9 @@ declare( strict_types = 1 ); * @see wp_register_ability_category() * @see wp_unregister_ability() * - * @param string $name The name of the ability. Must be the fully-namespaced - * string identifier, e.g. `my-plugin/my-ability` or `my-plugin/resource/my-ability`. + * @param string $name The name of the ability. Must be a namespaced string containing + * a prefix, e.g., `my-plugin/my-ability`. Can only contain lowercase + * alphanumeric characters, dashes, and forward slashes. * @param array $args { * An associative array of arguments for configuring the ability. * @@ -318,7 +318,7 @@ function wp_register_ability( string $name, array $args ): ?WP_Ability { * @see wp_register_ability() * * @param string $name The name of the ability to unregister, including namespace prefix - * (e.g., 'my-plugin/my-ability' or 'my-plugin/resource/find'). + * (e.g., 'my-plugin/my-ability'). * @return WP_Ability|null The unregistered ability instance on success, `null` on failure. */ function wp_unregister_ability( string $name ): ?WP_Ability { @@ -351,7 +351,7 @@ function wp_unregister_ability( string $name ): ?WP_Ability { * @see wp_get_ability() * * @param string $name The name of the ability to check, including namespace prefix - * (e.g., 'my-plugin/my-ability' or 'my-plugin/resource/find'). + * (e.g., 'my-plugin/my-ability'). * @return bool `true` if the ability is registered, `false` otherwise. */ function wp_has_ability( string $name ): bool { @@ -383,7 +383,7 @@ function wp_has_ability( string $name ): bool { * @see wp_has_ability() * * @param string $name The name of the ability, including namespace prefix - * (e.g., 'my-plugin/my-ability' or 'my-plugin/resource/find'). + * (e.g., 'my-plugin/my-ability'). * @return WP_Ability|null The registered ability instance, or `null` if not registered. */ function wp_get_ability( string $name ): ?WP_Ability { diff --git a/wp-includes/abilities-api/class-wp-abilities-registry.php b/wp-includes/abilities-api/class-wp-abilities-registry.php index 758dd2c252..ecd6dc2785 100644 --- a/wp-includes/abilities-api/class-wp-abilities-registry.php +++ b/wp-includes/abilities-api/class-wp-abilities-registry.php @@ -43,8 +43,9 @@ final class WP_Abilities_Registry { * * @see wp_register_ability() * - * @param string $name The name of the ability. Must be the fully-namespaced - * string identifier, e.g. `my-plugin/my-ability` or `my-plugin/resource/my-ability`. + * @param string $name The name of the ability. The name must be a string containing a namespace + * prefix, i.e. `my-plugin/my-ability`. It can only contain lowercase + * alphanumeric characters, dashes and the forward slash. * @param array $args { * An associative array of arguments for the ability. * @@ -77,11 +78,11 @@ final class WP_Abilities_Registry { * @return WP_Ability|null The registered ability instance on success, null on failure. */ public function register( string $name, array $args ): ?WP_Ability { - if ( ! preg_match( '/^[a-z0-9-]+(?:\/[a-z0-9-]+){1,3}$/', $name ) ) { + if ( ! preg_match( '/^[a-z0-9-]+\/[a-z0-9-]+$/', $name ) ) { _doing_it_wrong( __METHOD__, __( - 'Ability name must contain 2 to 4 segments separated by forward slashes, e.g. "my-plugin/my-ability" or "my-plugin/resource/my-ability". It can only contain lowercase alphanumeric characters, dashes, and forward slashes.' + 'Ability name must be a string containing a namespace prefix, i.e. "my-plugin/my-ability". It can only contain lowercase alphanumeric characters, dashes and the forward slash.' ), '6.9.0' ); diff --git a/wp-includes/abilities-api/class-wp-ability.php b/wp-includes/abilities-api/class-wp-ability.php index bdcb8c0bd0..967f164115 100644 --- a/wp-includes/abilities-api/class-wp-ability.php +++ b/wp-includes/abilities-api/class-wp-ability.php @@ -52,7 +52,7 @@ class WP_Ability { /** * The name of the ability, with its namespace. - * Examples: `my-plugin/my-ability`, `my-plugin/resource/find`. + * Example: `my-plugin/my-ability`. * * @since 6.9.0 * @var string @@ -340,7 +340,7 @@ class WP_Ability { /** * Retrieves the name of the ability, with its namespace. - * Examples: `my-plugin/my-ability`, `my-plugin/resource/find`. + * Example: `my-plugin/my-ability`. * * @since 6.9.0 * diff --git a/wp-includes/version.php b/wp-includes/version.php index 9756b560ce..ad860e0aeb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '7.0-beta6-62093'; +$wp_version = '7.0-beta6-62094'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.