Commit f3e8c615c8 for wordpress.org

commit f3e8c615c82b064669e9a69243ef73ac7110371b
Author: cbravobernal <cbravobernal@git.wordpress.org>
Date:   Tue Oct 15 14:13:19 2024 +0000

    Block Bindings: Fix panel not appearing in custom post types.

    There is a bug where the attributes panel is not shown in custom post types. This is caused because each post type can define a capability_type, which by default is post, so the logic to map the capabilities wasn't correct and it was returning false.

    Props santosguillamot, cbravobernal.
    Fixes #62226.

    Built from https://develop.svn.wordpress.org/trunk@59239


    git-svn-id: http://core.svn.wordpress.org/trunk@58631 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index 42e07a471d..d6c340c95e 100644
--- a/wp-includes/capabilities.php
+++ b/wp-includes/capabilities.php
@@ -825,8 +825,13 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
 				$caps[] = 'do_not_allow';
 				break;
 			}
-
-			$caps = map_meta_cap( "edit_{$object_subtype}", $user_id, $object_id );
+			$post_type_object = get_post_type_object( $object_subtype );
+			// Initialize empty array if it doesn't exist.
+			if ( ! isset( $post_type_object->capabilities ) ) {
+				$post_type_object->capabilities = array();
+			}
+			$post_type_capabilities = get_post_type_capabilities( $post_type_object );
+			$caps                   = map_meta_cap( $post_type_capabilities->edit_post, $user_id, $object_id );
 			break;
 		default:
 			// Handle meta capabilities for custom post types.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 984bd55268..46cc56a966 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '6.7-beta3-59238';
+$wp_version = '6.7-beta3-59239';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.