WordPress.org

Make WordPress Core

Changeset 41885


Ignore:
Timestamp:
10/16/2017 10:54:01 PM (3 years ago)
Author:
flixos90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/capabilities.php

    r41800 r41885  
    433433    case 'install_languages':
    434434    case 'update_languages':
     435        if ( ! function_exists( 'request_filesystem_credentials' ) ) {
     436            require_once( ABSPATH . 'wp-admin/includes/file.php' );
     437        }
     438
    435439        if ( ! function_exists( 'wp_can_install_language_pack' ) ) {
    436440            require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
Note: See TracChangeset for help on using the changeset viewer.