Make WordPress Core

Changeset 49952


Ignore:
Timestamp:
01/09/2021 08:20:44 PM (6 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Fix fatal error on multisite when calling the single item plugin routes.

The is_network_only_plugin and is_plugin_active functions are not available in a front-end context and must be specifically loaded.

Props oakesjosh.
Fixes #52205.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php

    r48641 r49952  
    210210         */
    211211        protected function check_read_permission( $plugin ) {
     212                require_once ABSPATH . 'wp-admin/includes/plugin.php';
     213
    212214                if ( ! $this->is_plugin_installed( $plugin ) ) {
    213215                        return new WP_Error( 'rest_plugin_not_found', __( 'Plugin not found.' ), array( 'status' => 404 ) );
Note: See TracChangeset for help on using the changeset viewer.