From 2147ec804b33bc1b9db2f4b84767990d28227a58 Mon Sep 17 00:00:00 2001
From: Daniel Jalkut <jalkut@red-sweater.com>
Date: Mon, 20 Sep 2021 13:43:19 -0400
Subject: [PATCH] When an empty terms_names array is provided, see that it
effectively overwrites any existing tags on the entry being updated.
---
src/wp-includes/class-wp-xmlrpc-server.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index 93809422d5..d712495087 100644
a
|
b
|
class wp_xmlrpc_server extends IXR_Server { |
1591 | 1591 | $taxonomies = array_keys( $post_data['terms_names'] ); |
1592 | 1592 | |
1593 | 1593 | foreach ( $taxonomies as $taxonomy ) { |
| 1594 | // In case an empty array was specified with terms_names, and no terms were specified by ID above, |
| 1595 | // we need to ensure an empty array is set to start for this taxonomy, so that existing terms will be removed. |
| 1596 | if ( ! array_key_exists( $taxonomy, $terms ) ) { |
| 1597 | $terms[ $taxonomy ] = array(); |
| 1598 | } |
| 1599 | |
1594 | 1600 | if ( ! array_key_exists( $taxonomy, $post_type_taxonomies ) ) { |
1595 | 1601 | return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) ); |
1596 | 1602 | } |