WP_Ability_Category::__constructpublicWP 6.9.0

Constructor.

Do not use this constructor directly. Instead, use the wp_register_ability_category()

Method of the class: WP_Ability_Category{}

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Returns

null. Nothing (null).

Usage

$WP_Ability_Category = new WP_Ability_Category();
$WP_Ability_Category->__construct( $slug, $args );
$slug(string) (required)
The unique slug for the ability category.
$args(array) (required)
.

Notes

Changelog

Since 6.9.0 Introduced.

WP_Ability_Category::__construct() code WP 6.9

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;
		}

		$this->$property_name = $property_value;
	}
}