WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_User::get_role_caps() public WP 2.0.0

Retrieves all of the capabilities of the user's roles, and merges them with individual user capabilities.

All of the capabilities of the user's roles are merged with the user's individual capabilities. This means that the user can be denied specific capabilities that their role might have, but the user is specifically denied.

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

Хуков нет.

Возвращает

true/false[]. Array of key/value pairs where keys represent a capability name and boolean values represent whether the user has that capability.

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

$WP_User = new WP_User();
$WP_User->get_role_caps();

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

С версии 2.0.0 Введена.

Код WP_User::get_role_caps() WP 5.5.1

wp-includes/class-wp-user.php
<?php
public function get_role_caps() {
	$switch_site = false;
	if ( is_multisite() && get_current_blog_id() != $this->site_id ) {
		$switch_site = true;

		switch_to_blog( $this->site_id );
	}

	$wp_roles = wp_roles();

	// Filter out caps that are not role names and assign to $this->roles.
	if ( is_array( $this->caps ) ) {
		$this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );
	}

	// Build $allcaps from role caps, overlay user's $caps.
	$this->allcaps = array();
	foreach ( (array) $this->roles as $role ) {
		$the_role      = $wp_roles->get_role( $role );
		$this->allcaps = array_merge( (array) $this->allcaps, (array) $the_role->capabilities );
	}
	$this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps );

	if ( $switch_site ) {
		restore_current_blog();
	}

	return $this->allcaps;
}