WP_Ability::__construct
Constructor.
Do not use this constructor directly. Instead, use the wp_register_ability()
Метод класса: WP_Ability{}
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WP_Ability = new WP_Ability(); $WP_Ability->__construct( $name, $args );
- $name(строка) (обязательный)
- The name of the ability, with its namespace.
- $args(массив) (обязательный)
- .
Заметки
- Смотрите: wp_register_ability()
Список изменений
| С версии 6.9.0 | Введена. |
Код WP_Ability::__construct() WP Ability:: construct WP 6.9
public function __construct( string $name, array $args ) {
$this->name = $name;
$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 "%2$s". Please check the %3$s class for allowed properties.' ),
'<code>' . esc_html( $property_name ) . '</code>',
'<code>' . esc_html( $this->name ) . '</code>',
'<code>' . __CLASS__ . '</code>'
),
'6.9.0'
);
continue;
}
$this->$property_name = $property_value;
}
}