WPSEO_Abstract_Capability_Manager::filter_roles()protectedYoast 1.0

Filter capability roles.

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

Хуки из метода

Возвращает

Массив. Filtered list of roles for the capability.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->filter_roles( $capability, $roles );
$capability(строка) (обязательный)
Capability to filter roles for.
$roles(массив) (обязательный)
List of roles which can be filtered.

Код WPSEO_Abstract_Capability_Manager::filter_roles() Yoast 22.3

protected function filter_roles( $capability, array $roles ) {
	/**
	 * Filter: Allow changing roles that a capability is added to.
	 *
	 * @param array $roles The default roles to be filtered.
	 */
	$filtered = apply_filters( $capability . '_roles', $roles );

	// Make sure we have the expected type.
	if ( ! is_array( $filtered ) ) {
		return [];
	}

	return $filtered;
}