wppaste
WordPress

WP_Ability_Category

Since
6.9.0
Source
wp-includes/abilities-api/class-wp-ability-category.php:21
Encapsulates the properties and methods related to a specific ability category.

Compatibility

WordPress
since 6.9.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in 3 of the 5 tracked releases, added in 6.9.0.

Properties · 4

$slugstringprotected
The unique slug for the ability category.
$labelstringprotected
The human-readable ability category label.
$descriptionstringprotected
The detailed ability category description.
$metaarray<string,protected
The optional ability category metadata.

Methods · 8

Source code

final class WP_Ability_Category { 	/**	 * The unique slug for the ability category.	 *	 * @since 6.9.0	 * @var string	 */	protected $slug; 	/**	 * The human-readable ability category label.	 *	 * @since 6.9.0	 * @var string	 */	protected $label; 	/**	 * The detailed ability category description.	 *	 * @since 6.9.0	 * @var string	 */	protected $description; 	/**	 * The optional ability category metadata.	 *	 * @since 6.9.0	 * @var array<string, mixed>	 */	protected $meta = array(); 	/**	 * Constructor.	 *	 * Do not use this constructor directly. Instead, use the `wp_register_ability_category()` function.	 *	 * @access private	 *	 * @since 6.9.0	 *	 * @see wp_register_ability_category()	 *	 * @param string               $slug The unique slug for the ability category.	 * @param array<string, mixed> $args {	 *     An associative array of arguments for the ability category.	 *	 *     @type string               $label       The human-readable label for the ability category.	 *     @type string               $description A description of the ability category.	 *     @type array<string, mixed> $meta        Optional. Additional metadata for the ability category.	 * }	 * @throws InvalidArgumentException If an argument is invalid.	 */	public function __construct( string $slug, array $args ) {		if ( empty( $slug ) ) {			throw new InvalidArgumentException(				__( 'The ability category slug cannot be empty.' )			);		} 		$this->slug = $slug; 		$properties = $this->prepare_properties( $args ); 		foreach ( $properties as $property_name => $property_value ) {			if ( ! property_exists( $this, $property_name ) ) {				_doing_it_wrong(					__METHOD__,					sprintf(						/* translators: %s: Property name. */						__( 'Property "%1$s" is not a valid property for ability category "%2$s". Please check the %3$s class for allowed properties.' ),						'<code>' . esc_html( $property_name ) . '</code>',						'<code>' . esc_html( $this->slug ) . '</code>',						'<code>' . __CLASS__ . '</code>'					),					'6.9.0'				);				continue;

Changelog

Introduced in 6.9.0. Unchanged from 6.9.7 through 7.1.0.

  1. 6.9.7
  2. 7.0.4
  3. 7.1.0

Signature, return type and hooks compared across 3 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/abilities-api/class-wp-ability-category.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.