-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
$_POST
data (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$request
object.Taxonomy updates are limited to those shown in the REST API.
Closes #625
How to test the Change
develop
branch.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: