diff --git a/package.json b/package.json
index 12a90c83b077b..4b51f22f896b2 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"url": "https://develop.svn.wordpress.org/trunk"
},
"gutenberg": {
- "sha": "efd7722f89ebb8abfc3607fffdd86f5e34afbd9c",
+ "sha": "c5bdc7f4898ec98114cdccbe1cacec7a979b85cc",
"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..dca8010311142 100644
--- a/src/wp-includes/assets/script-loader-packages.php
+++ b/src/wp-includes/assets/script-loader-packages.php
@@ -105,7 +105,7 @@
'wp-url',
'wp-warning'
),
- 'version' => 'f9a3114894c529a215ac'
+ 'version' => 'e21efcc5c30f26ee0aba'
),
'block-library.js' => array(
'dependencies' => array(
@@ -151,7 +151,7 @@
'import' => 'dynamic'
)
),
- 'version' => '58156d96a4c9fdf86645'
+ 'version' => '9ad7f7e62e9fbecbab34'
),
'block-serialization-default-parser.js' => array(
'dependencies' => array(
@@ -549,7 +549,7 @@
'import' => 'static'
)
),
- 'version' => '33deefc6545abe93022a'
+ 'version' => 'c1e50b340a6f2a32176c'
),
'element.js' => array(
'dependencies' => array(
@@ -670,7 +670,7 @@
'wp-url',
'wp-warning'
),
- 'version' => 'd91937a9b82062da49eb'
+ 'version' => '5ef0448131de57454ed0'
),
'notices.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..9fcc01076e986 100644
--- a/src/wp-includes/assets/script-modules-packages.php
+++ b/src/wp-includes/assets/script-modules-packages.php
@@ -10,7 +10,7 @@
'wp-data',
'wp-i18n'
),
- 'version' => '9448bb3053516a39086d'
+ 'version' => '2dfc1cc1ffd6007eaacd'
),
'block-editor/utils/fit-text-frontend.js' => array(
'dependencies' => array(
@@ -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/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/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 @@
-
+
+
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.