- Timestamp:
- 02/09/2026 04:59:52 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/abilities-api/class-wp-abilities-registry.php
r61086 r61602 44 44 * @see wp_register_ability() 45 45 * 46 * @param string $name The name of the ability. The name must be a string containing a namespace 47 * prefix, i.e. `my-plugin/my-ability`. It can only contain lowercase 48 * alphanumeric characters, dashes and the forward slash. 46 * @param string $name The name of the ability. Must be the fully-namespaced 47 * string identifier, e.g. `my-plugin/my-ability` or `my-plugin/resource/my-ability`. 49 48 * @param array<string, mixed> $args { 50 49 * An associative array of arguments for the ability. … … 79 78 */ 80 79 public function register( string $name, array $args ): ?WP_Ability { 81 if ( ! preg_match( '/^[a-z0-9-]+ \/[a-z0-9-]+$/', $name ) ) {80 if ( ! preg_match( '/^[a-z0-9-]+(?:\/[a-z0-9-]+){1,3}$/', $name ) ) { 82 81 _doing_it_wrong( 83 82 __METHOD__, 84 83 __( 85 '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.'84 '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.' 86 85 ), 87 86 '6.9.0'
Note: See TracChangeset
for help on using the changeset viewer.