WP_Ability_Category::__construct( string $slug,  $args )

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Constructor.

Description

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

See also

Parameters

$slugstringrequired
The unique slug for the ability category.
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.
}

Source

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

Changelog

VersionDescription
6.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.