Page Attributes: Fix: Parent-Dropdown missing for custom post-type. #8087
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: #7926
Regressed in: #6657
We were allowing unbound requests for pages because pages have a parent picker UI that needed unbound requests. Pages were not the only CPT's that allow choosing a parent post. This commit makes sure we allow unbound requests for all hierarchical post types.
Here we try to keep the same logic added in #6657 but we apply it to all Hierarchical CPT's and not just pages.
A minor correction to the documentation was also applied, the parameter $post_type of the function gutenberg_filter_post_collection_parameters is a (WP_Post_Type) oject not a string. https://developer.wordpress.org/reference/hooks/rest_this-post_type_collection_params/
How has this been tested?
I added a hierarchical CPT and verified the Parent page picker appeared in the page attributes settings: