diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
index ea4ae947cc..227210b141 100644
|
a
|
b
|
public function prepare_item_for_response( $post, $request ) { |
| 788 | 788 | } else { |
| 789 | 789 | $data['media_details']['sizes'] = new stdClass; |
| 790 | 790 | } |
| | 791 | |
| | 792 | if ( ! isset( $data['media_details']['filesize'] ) ) { |
| | 793 | $attached_file = get_attached_file( $post->ID ); |
| | 794 | if ( is_readable( $attached_file ) ) { |
| | 795 | $data['media_details']['filesize'] = filesize( $attached_file ); |
| | 796 | } |
| | 797 | } |
| 791 | 798 | } |
| 792 | 799 | |
| 793 | 800 | if ( in_array( 'post', $fields, true ) ) { |