wp_maybe_grant_resume_extensions_caps() WordPress Function

The wp_maybe_grant_resume_extensions_caps() function is a utility function that allows for the granting of additional capabilities to a user that have been added by a resume extension plugin. This is typically used when a user installs a new extension or when a new capability is added to an extension.

wp_maybe_grant_resume_extensions_caps( bool[] $allcaps ) #

Filters the user capabilities to grant the ‘resume_plugins’ and ‘resume_themes’ capabilities as necessary.


Parameters

$allcaps

(bool[])(Required)An array of all the user's capabilities.


Top ↑

Return

(bool[]) Filtered array of the user's capabilities.


Top ↑

Source

File: wp-includes/capabilities.php

function wp_maybe_grant_resume_extensions_caps( $allcaps ) {
	// Even in a multisite, regular administrators should be able to resume plugins.
	if ( ! empty( $allcaps['activate_plugins'] ) ) {
		$allcaps['resume_plugins'] = true;
	}

	// Even in a multisite, regular administrators should be able to resume themes.
	if ( ! empty( $allcaps['switch_themes'] ) ) {
		$allcaps['resume_themes'] = true;
	}

	return $allcaps;
}

Top ↑

Changelog

Changelog
VersionDescription
5.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.