Skip to content

Conversation

@jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Jul 20, 2018

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:

 function myplugin_register_hierarchical_book_type() {
    $args = array(
        'public' => true,
        'label'  => 'Books Hierarchical',
        'show_in_rest' => true,
        'hierarchical'       => true,
        'supports'       => array( 'page-attributes' ),
    );
    register_post_type( 'book_lock', $args );
}
add_action( 'init', 'myplugin_register_hierarchical_book_type' );

@jorgefilipecosta jorgefilipecosta self-assigned this Jul 20, 2018
@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release labels Jul 20, 2018
We here allowing unbound requests for pages because pages have a parent picker UI than needed unbound requests. Pages were not the only CPT's that allow choosing a parent post. This commits makes sure we allow unbound requests for all hierarchical post types.
@jorgefilipecosta jorgefilipecosta force-pushed the fix/Parent-Dropdown-missing-for-custom-post-type branch from ce95e57 to cc39590 Compare July 23, 2018 11:05
@jorgefilipecosta jorgefilipecosta requested a review from a team August 1, 2018 11:45
@aduth aduth requested a review from danielbachhuber August 1, 2018 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants