wp_maybe_grant_install_languages_cap() WordPress Function

The wp_maybe_grant_install_languages_cap() function is used to check if the current user has the capability to install new languages. This function is only available to super admins.

wp_maybe_grant_install_languages_cap( bool[] $allcaps ) #

Filters the user capabilities to grant the ‘install_languages’ capability as necessary.


Description

A user must have at least one out of the ‘update_core’, ‘install_plugins’, and ‘install_themes’ capabilities to qualify for ‘install_languages’.


Top ↑

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_install_languages_cap( $allcaps ) {
	if ( ! empty( $allcaps['update_core'] ) || ! empty( $allcaps['install_plugins'] ) || ! empty( $allcaps['install_themes'] ) ) {
		$allcaps['install_languages'] = true;
	}

	return $allcaps;
}

Top ↑

Changelog

Changelog
VersionDescription
4.9.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.