WP_User::_init_caps()protectedWP 2.1.0

Устарела с версии 4.9.0. Больше не поддерживается и может быть удалена. Используйте WP_User::for_site().

Sets up capability object properties.

Will set the value for the 'cap_key' property to current database table prefix, followed by 'capabilities'. Will then check to see if the property matching the 'cap_key' exists and is an array. If so, it will be used.

Метод класса: WP_User{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->_init_caps( $cap_key );
$cap_key(строка)
Optional capability key
По умолчанию: ''

Заметки

  • Global. wpdb. $wpdb WordPress database abstraction object.

Список изменений

С версии 2.1.0 Введена.
Устарела с 4.9.0 Use WP_User::for_site()

Код WP_User::_init_caps() WP 6.5.2

protected function _init_caps( $cap_key = '' ) {
	global $wpdb;

	_deprecated_function( __METHOD__, '4.9.0', 'WP_User::for_site()' );

	if ( empty( $cap_key ) ) {
		$this->cap_key = $wpdb->get_blog_prefix( $this->site_id ) . 'capabilities';
	} else {
		$this->cap_key = $cap_key;
	}

	$this->caps = $this->get_caps_data();

	$this->get_role_caps();
}