Role/Capability: Prevent a fatal error when checking a language capability early or in the frontend.

The meta capabilities `install_languages` and `update_languages` rely on the admin function `wp_can_install_language_pack()`. That function in turn relies on `request_filesystem_credentials()`, so it needs to be ensured that this function is available as well.

Fixes #42230.


git-svn-id: https://develop.svn.wordpress.org/trunk@41885 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz 2017-10-16 22:54:01 +00:00
parent ad1d11f88d
commit 87410d2692
1 changed files with 4 additions and 0 deletions

View File

@ -432,6 +432,10 @@ function map_meta_cap( $cap, $user_id ) {
break;
case 'install_languages':
case 'update_languages':
if ( ! function_exists( 'request_filesystem_credentials' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
if ( ! function_exists( 'wp_can_install_language_pack' ) ) {
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
}