From ed54a900e30cd4e2c068c6e66d275cecc510ae2b Mon Sep 17 00:00:00 2001 From: whyisjake Date: Thu, 28 Jan 2021 00:34:59 +0000 Subject: [PATCH] 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. This commit brings the changes from [49952] to the 5.6 branch. Props oakesjosh, johnbillion, TimothyBlynJacobs. Fixes #52205. Built from https://develop.svn.wordpress.org/branches/5.6@50046 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49747 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../rest-api/endpoints/class-wp-rest-plugins-controller.php | 2 ++ wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php index 4eca50b549..c4155ad63d 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php @@ -209,6 +209,8 @@ class WP_REST_Plugins_Controller extends WP_REST_Controller { * @return true|WP_Error True if can read, a WP_Error instance otherwise. */ protected function check_read_permission( $plugin ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + if ( ! $this->is_plugin_installed( $plugin ) ) { return new WP_Error( 'rest_plugin_not_found', __( 'Plugin not found.' ), array( 'status' => 404 ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2f53696ad8..ea886358ee 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6.1-alpha-50045'; +$wp_version = '5.6.1-alpha-50046'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.