Sync empty taxonomies to distributed posts.#951
Conversation
This allows updates which include an empting of a taxonomy of all it’s terms. Sending a taxonomy with an empty array as standard post data gets removed from the REST request.
|
The tests here are failing because the following returns \WP_Mock::userFunction(
'\Distributor\Utils\prepare_taxonomy_terms', [
'return' => [],
]
);I did a var_dump on the following line within |
cadic
left a comment
There was a problem hiding this comment.
The code looks good.
BTW, I was not able to replicate the original issue (at develop branch: after second-the-last tag was deleted in the original post, the distributed post has no tags as well on the step 8).
|
@cadic Do you recall if you were testing on an internal (multisite) connection or an external connection? |
|
@peterwilsoncc oh, thanks for clarifying that, it does reproduce with the external connection. |
|
Thanks Max, sorry I missed that step in the reproduction notes. |
Description of the Change
This modifies
prepare_taxonomy_terms()to include both populated and unpopulated taxonomies when distributing sites.This allows for the situation in which an original post is updated to remove all terms within a shared taxonomy.
To account for empty arrays being stripped from
$_POSTdata (I've not been able to determine where this happens), update notifications are now sent as JSON encoded data to the remote sites REST API. This may be a backward compatibility issue for sites using hooks and getting POSTed data rather than using the$requestobject.Taxonomy updates are limited to those shown in the REST API.
Closes #625
How to test the Change
developbranch.Notes
@wordpress/env-- it was fixed five days ago but is still to be released WordPress/gutenberg@3983feeChangelog Entry
Credits
Props @peterwilsoncc, @manolobevia, @jeffpaul, @cadic
Checklist: