- Timestamp:
- 03/23/2026 07:39:45 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/abilities-api/class-wp-abilities-registry.php
r61602 r62094 44 44 * @see wp_register_ability() 45 45 * 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`. 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. 48 49 * @param array<string, mixed> $args { 49 50 * An associative array of arguments for the ability. … … 78 79 */ 79 80 public function register( string $name, array $args ): ?WP_Ability { 80 if ( ! preg_match( '/^[a-z0-9-]+ (?:\/[a-z0-9-]+){1,3}$/', $name ) ) {81 if ( ! preg_match( '/^[a-z0-9-]+\/[a-z0-9-]+$/', $name ) ) { 81 82 _doing_it_wrong( 82 83 __METHOD__, 83 84 __( 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.'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.' 85 86 ), 86 87 '6.9.0'
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)