-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[WIP] Global styles controller: extend with WP_REST_Posts_Controller #6008
[WIP] Global styles controller: extend with WP_REST_Posts_Controller #6008
Conversation
Extending `WP_REST_Global_Styles_Controller` with `WP_REST_Posts_Controller`
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
@ramonjd are you checking the unit test failure? |
@mukeshpanchal27 This PR is work in progress (WIP) so, no, not yet. I still need to work on the feature a bit first. Thanks! |
@@ -134,6 +134,8 @@ public function test_expected_routes_in_schema() { | |||
'/wp/v2/comments', | |||
'/wp/v2/comments/(?P<id>[\\d]+)', | |||
'/wp/v2/global-styles/(?P<id>[\/\w-]+)', | |||
'/wp/v2/global-styles/(?P<id>[\d]+)/autosaves', | |||
'/wp/v2/global-styles/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)', |
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.
It would be handy to be able to opt-out of these as well if folks want to skip registering these routes, e.g., 'autosave_rest_controller_class' => false,
in register_post_type()
.
1f51e1f#diff-52c8c412194f4e6bf199f6bbf576b66410eb470aa181330bdd7c290c9ed075e4R929
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.
Or a supports_autosaves
, similar to supports_revisions
? 🤷🏻
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.
@ramonjd For now, we could just add the global post type here -
wordpress-develop/src/wp-includes/class-wp-post-type.php
Lines 925 to 927 in 235cb39
if ( 'attachment' === $this->name ) { | |
return null; | |
} |
WIP - Extending
WP_REST_Global_Styles_Controller
withWP_REST_Posts_Controller
See: #5699 (review)