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

WPSEO_Register_Capabilities::filter_user_has_wpseo_manage_options_cap() public Yoast 1.0

Revokes the 'wpseo_manage_options' capability from administrator users if it should only be granted to network administrators.

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

Хуков нет.


Массив. Possibly modified array of the user's capabilities.


$WPSEO_Register_Capabilities = new WPSEO_Register_Capabilities();
$WPSEO_Register_Capabilities->filter_user_has_wpseo_manage_options_cap( $allcaps, $caps, $args, $user );
$allcaps(массив) (обязательный)
An array of all the user's capabilities.
$caps(массив) (обязательный)
Actual capabilities being checked.
$args(массив) (обязательный)
Optional parameters passed to has_cap(), typically object ID.
$user(WP_User) (обязательный)
The user object.

Код WPSEO_Register_Capabilities::filter_user_has_wpseo_manage_options_cap() Yoast 15.2

public function filter_user_has_wpseo_manage_options_cap( $allcaps, $caps, $args, $user ) {

	// We only need to do something if 'wpseo_manage_options' is being checked.
	if ( ! in_array( 'wpseo_manage_options', $caps, true ) ) {
		return $allcaps;

	// If the user does not have 'wpseo_manage_options' anyway, we don't need to revoke access.
	if ( empty( $allcaps['wpseo_manage_options'] ) ) {
		return $allcaps;

	// If the user does not have 'delete_users', they are not an administrator.
	if ( empty( $allcaps['delete_users'] ) ) {
		return $allcaps;

	$options = WPSEO_Options::get_instance();

	if ( $options->get( 'access' ) === 'superadmin' && ! is_super_admin( $user->ID ) ) {
		unset( $allcaps['wpseo_manage_options'] );

	return $allcaps;