Skip to content

Commit 324d440

Browse files
committed
REST API: Load missing required file for multisite users in WP_REST_Attachments_Controller::check_upload_size().
Requires wp-admin/includes/ms.php to make `upload_is_user_over_quota()` function available to multisite users uploading files. Props JakePT, rachelbaker. Fixes #44864. git-svn-id: https://develop.svn.wordpress.org/trunk@43603 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2eb9362 commit 324d440

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,9 @@ protected function check_upload_size( $file ) {
805805
return new WP_Error( 'rest_upload_file_too_big', sprintf( __( 'This file is too big. Files must be less than %s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) ), array( 'status' => 400 ) );
806806
}
807807

808+
// Include admin function to get access to upload_is_user_over_quota().
809+
require_once ABSPATH . 'wp-admin/includes/ms.php';
810+
808811
if ( upload_is_user_over_quota( false ) ) {
809812
return new WP_Error( 'rest_upload_user_quota_exceeded', __( 'You have used your space quota. Please delete files before uploading.' ), array( 'status' => 400 ) );
810813
}

0 commit comments

Comments
 (0)