-
Notifications
You must be signed in to change notification settings - Fork 651
Add controller for a post's terms #1216
Conversation
This allows you to create and delete post term relationships
|
@WP-API/amigos #review |
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.
Need to pass taxonomy here too, as the route should be explicitly defined based on the taxonomy. See #1170
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.
👍
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.
Added in 20621e8
|
Some nits. |
This is to make things simpler.
|
Ready for another look! |
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.
Do we need to check show_in_rest or public values for this taxonomy?
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.
Based off https://github.com/WP-API/WP-API/blob/develop/lib/endpoints/class-wp-rest-taxonomies-controller.php#L92-93 I think no (or at least that this point anyway). If we want to adopt show_in_rest for taxonomies, it should probably be applied universally and start at the taxonomies controller.
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.
Oh, maybe I need to check public though
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.
Actually, turns out we don't need this now that the controller is a post_type / taxonomy pair. This checking is done already on route registration in plugin.php.
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.
Seems like the previous ~10 lines of checks should be abstracted in some form.
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.
Fixed in 36c8073
|
@joehoyle left some comments |
This is already accounted for by setting up the taxonomy
Conflicts: tests/test-rest-terms-controller.php It looks like you may be committing a merge. If this is not correct, please remove the file .git/MERGE_HEAD and try again.
|
@danielbachhuber want another bash? |
Add controller for a post's terms
|
🍰 |
Should we allow
DELETE /wp/v2/posts/1/terms/post_tagto remove all tags from the post?Also should we allow
POST /wp/v2/posts/1/terms/post_tagwith body{ ids: 1,2,3,4 }to assign more than 1 term to a post?See #1199