mirror of
git://develop.git.wordpress.org/
synced 2025-02-22 15:42:29 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@49952 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c8c248e967
commit
1f2695ed1f
@ -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 ) );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user