From db8bed16c7ab30d41a7e763efb08b7010024841d Mon Sep 17 00:00:00 2001 From: drewmt Date: Tue, 27 Oct 2026 11:33:02 +0200 Subject: [PATCH 1/3] Entity Fields: Require hierarchy for the parent field --- .../build/scripts/core-fields/index.php | 4 +- .../wpRegisterCoreFieldCollections.php | 46 ++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/build/scripts/core-fields/index.php b/src/wp-includes/build/scripts/core-fields/index.php index 8b4b10f88233e..8d9fdc42b6dd9 100644 --- a/src/wp-includes/build/scripts/core-fields/index.php +++ b/src/wp-includes/build/scripts/core-fields/index.php @@ -32,7 +32,7 @@ * - `last_edited_date`, for every post type. * - `notesCount`, for the post types whose `editor` support has the `notes` * argument. - * - `parent`, for the post types supporting `page-attributes`. + * - `parent`, for hierarchical post types supporting `page-attributes`. * - `password`, for every post type but the design ones. * - `ping_status`, for the post types supporting `trackbacks`. * - `post-content-info`, for the post types supporting `editor`. @@ -71,7 +71,7 @@ function wp_register_core_post_type_supports_fields() { 'format' => post_type_supports( $post_type, 'post-formats' ) && current_theme_supports( 'post-formats' ), 'last_edited_date' => true, 'notesCount' => is_array( $editor ) && (bool) array_filter( array_column( $editor, 'notes' ) ), - 'parent' => post_type_supports( $post_type, 'page-attributes' ), + 'parent' => is_post_type_hierarchical( $post_type ) && post_type_supports( $post_type, 'page-attributes' ), 'password' => true, 'ping_status' => post_type_supports( $post_type, 'trackbacks' ), 'post-content-info' => post_type_supports( $post_type, 'editor' ), diff --git a/tests/phpunit/tests/entity-fields/wpRegisterCoreFieldCollections.php b/tests/phpunit/tests/entity-fields/wpRegisterCoreFieldCollections.php index 6f9f4ab660089..6150def80e2ee 100644 --- a/tests/phpunit/tests/entity-fields/wpRegisterCoreFieldCollections.php +++ b/tests/phpunit/tests/entity-fields/wpRegisterCoreFieldCollections.php @@ -286,7 +286,6 @@ public static function data_default_fields_and_their_supports() { return array( 'discussion' => array( 'discussion', array( 'comments', 'trackbacks' ) ), 'excerpt' => array( 'excerpt', array( 'excerpt' ) ), - 'parent' => array( 'parent', array( 'page-attributes' ) ), 'ping_status' => array( 'ping_status', array( 'trackbacks' ) ), 'title' => array( 'title', array( 'title' ) ), 'post-content-info' => array( 'post-content-info', array( 'editor' ) ), @@ -318,6 +317,51 @@ public function test_a_default_field_follows_its_supports( $field_id, $supports $this->assertNotContains( $field_id, self::get_field_ids( 'test_without' ), 'A post type without the supports does not get the field.' ); } + /** + * Data provider. + * + * @return array[] Post type settings and expected parent field registration. + */ + public static function data_parent_field_requirements() { + return array( + 'hierarchical with attributes' => array( true, true, true ), + 'hierarchical without attributes' => array( true, false, false ), + 'non-hierarchical with attributes' => array( false, true, false ), + 'non-hierarchical without attributes' => array( false, false, false ), + ); + } + + /** + * The parent field requires both hierarchy and page attributes support. + * + * @ticket 66428 + * + * @dataProvider data_parent_field_requirements + * + * @param bool $hierarchical Whether the post type is hierarchical. + * @param bool $has_attributes Whether the post type supports page attributes. + * @param bool $has_parent Whether the parent field should be registered. + */ + public function test_the_parent_field_requires_hierarchy_and_page_attributes( $hierarchical, $has_attributes, $has_parent ) { + register_post_type( + 'test_parent', + array( + 'show_in_rest' => true, + 'hierarchical' => $hierarchical, + 'supports' => $has_attributes ? array( 'page-attributes' ) : array(), + ) + ); + + try { + self::reset_registry(); + $ids = self::get_field_ids( 'test_parent' ); + } finally { + unregister_post_type( 'test_parent' ); + } + + $this->assertSame( $has_parent, in_array( 'parent', $ids, true ) ); + } + /** * The default fields come from the `field.php` files of the * `post_type_supports` folder. From e89ad4d079d54b3ee4abf40450619d476c168ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Fri, 20 Nov 2026 12:50:56 +0100 Subject: [PATCH 2/3] Entity Fields: Say the parent field is for hierarchical post types Its definition still described the support-only condition. Matches https://github.com/WordPress/gutenberg/pull/85679. Co-Authored-By: Claude Opus 5.5 --- .../scripts/core-fields/post_type_supports/parent/field.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php b/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php index d26460c976ad8..f3a04ab52ce2f 100644 --- a/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php +++ b/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php @@ -1,8 +1,8 @@ Date: Fri, 20 Nov 2026 14:35:06 +0100 Subject: [PATCH 3/3] General: Bump the pinned hash for Gutenberg to `91e24b4`. This updates the pinned commit hash of the Gutenberg repository from `efd7722f89ebb8abfc3607fffdd86f5e34afbd9c` to `91e24b4c4d64796704663e88fae1459882635041`. It brings in the JavaScript part of hiding the parent controls for non-hierarchical post types, and makes the built `core-fields` files match the PHP changes of this branch. A full list of changes included in this commit can be found on GitHub: https://github.com/WordPress/gutenberg/compare/efd7722f89ebb8abfc3607fffdd86f5e34afbd9c...91e24b4c4d64796704663e88fae1459882635041. Co-Authored-By: Claude Opus 5.5 --- package.json | 2 +- src/wp-includes/assets/script-loader-packages.php | 2 +- src/wp-includes/assets/script-modules-packages.php | 6 +++--- src/wp-includes/images/icon-library/update.svg | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 12a90c83b077b..36551835ac2e2 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://develop.svn.wordpress.org/trunk" }, "gutenberg": { - "sha": "efd7722f89ebb8abfc3607fffdd86f5e34afbd9c", + "sha": "91e24b4c4d64796704663e88fae1459882635041", "ghcrRepo": "WordPress/gutenberg/gutenberg-wp-develop-build" }, "engines": { diff --git a/src/wp-includes/assets/script-loader-packages.php b/src/wp-includes/assets/script-loader-packages.php index e33f77b5f7755..b02a85828d50d 100644 --- a/src/wp-includes/assets/script-loader-packages.php +++ b/src/wp-includes/assets/script-loader-packages.php @@ -549,7 +549,7 @@ 'import' => 'static' ) ), - 'version' => '33deefc6545abe93022a' + 'version' => 'db347952db18c7450be1' ), 'element.js' => array( 'dependencies' => array( diff --git a/src/wp-includes/assets/script-modules-packages.php b/src/wp-includes/assets/script-modules-packages.php index a0560e1063778..e1f80a5103396 100644 --- a/src/wp-includes/assets/script-modules-packages.php +++ b/src/wp-includes/assets/script-modules-packages.php @@ -349,7 +349,7 @@ 'import' => 'static' ) ), - 'version' => '2aa2fe44937a04cb98c7' + 'version' => '5a1005804ad8a5083c79' ), 'core-fields/root_site.js' => array( 'dependencies' => array( @@ -466,7 +466,7 @@ 'dependencies' => array( ), - 'version' => 'b2185b9b3c06dcd1869d' + 'version' => '0c838873c424e941c437' ), 'interactivity-router/full-page.js' => array( 'dependencies' => array( @@ -494,7 +494,7 @@ 'import' => 'static' ) ), - 'version' => 'c0110eac0afb41d3f204' + 'version' => '4555574d1243e79178f5' ), 'latex-to-mathml/index.js' => array( 'dependencies' => array( diff --git a/src/wp-includes/images/icon-library/update.svg b/src/wp-includes/images/icon-library/update.svg index abf7d3491b6ce..0658ad2f1ed6d 100644 --- a/src/wp-includes/images/icon-library/update.svg +++ b/src/wp-includes/images/icon-library/update.svg @@ -1,3 +1,4 @@ - + +