From ce230b87427c47d971255bdfc040a0407ccd1e68 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 30 Jan 2024 08:39:16 +0000 Subject: [PATCH] REST API: Support assigning terms when creating attachments. Props mukesh27, Dharm1025, Ankit K Gupta, swissspidy, dharm1025, tanjimtc71, timothyblynjacobs, spacedmonkey. Fixes #57897. Built from https://develop.svn.wordpress.org/trunk@57380 git-svn-id: http://core.svn.wordpress.org/trunk@56886 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../endpoints/class-wp-rest-attachments-controller.php | 6 ++++++ wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php index c7da6d068b..d6bba7a924 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php @@ -186,6 +186,12 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { return $fields_update; } + $terms_update = $this->handle_terms( $attachment_id, $request ); + + if ( is_wp_error( $terms_update ) ) { + return $terms_update; + } + $request->set_param( 'context', 'edit' ); /** diff --git a/wp-includes/version.php b/wp-includes/version.php index be4f84ca2c..d722002eea 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57379'; +$wp_version = '6.5-alpha-57380'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.