From 1e476cf34d5e44f99dc892bbcf81ec73c6f227ec Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Sun, 16 Dec 2018 01:25:27 +0000 Subject: [PATCH] REST API: Restore access to audio/video metadata functions. Ensures `wp_read_video_metadata()`/`wp_read_audio_metadata()` functions are available when uploading video and audio. Fixes error introduced in [43589]. Merges [43850] from the 5.0 branch to trunk. Props ocean90. See #43757. git-svn-id: https://develop.svn.wordpress.org/trunk@44216 602fd350-edb4-49c9-b593-d223f7449a82 --- .../rest-api/endpoints/class-wp-rest-attachments-controller.php | 1 + 1 file changed, 1 insertion(+) 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 2612f66c9f..8aa0002bc0 100644 --- 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 @@ -173,6 +173,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { do_action( 'rest_insert_attachment', $attachment, $request, true ); // Include admin function to get access to wp_generate_attachment_metadata(). + require_once ABSPATH . 'wp-admin/includes/media.php'; require_once ABSPATH . 'wp-admin/includes/image.php'; wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );