Commit 5f80552e18 for wordpress.org

commit 5f80552e18a1abcdcf6d13650441f27f3616069f
Author: spacedmonkey <spacedmonkey@git.wordpress.org>
Date:   Fri Sep 11 16:51:53 2026 +0000

    Meta: Support site meta subtype in get_object_subtype().

    Add a 'blog' case to get_object_subtype() so register_meta() can resolve
    subtypes for site meta, matching the support already in place for posts,
    terms, comments, and users.

    Introduce register_site_meta() and unregister_site_meta() wrapper
    functions for registering and unregistering meta for sites, consistent
    with the existing site meta wrapper functions.

    Props sainathpoojary, spacedmonkey, flixos90, johnbillion.
    Fixes #44387.
    Built from https://develop.svn.wordpress.org/trunk@63603


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

diff --git a/wp-includes/meta.php b/wp-includes/meta.php
index 577785c216..7bce5f40c0 100644
--- a/wp-includes/meta.php
+++ b/wp-includes/meta.php
@@ -1789,6 +1789,7 @@ function _wp_register_meta_args_allowed_list( $args, $default_args ) {
  * Returns the object subtype for a given object ID of a specific type.
  *
  * @since 4.9.8
+ * @since 7.2.0 Added support for 'blog' object type in multisite.
  *
  * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
  *                            'user', or any other object type with an associated meta table.
@@ -1834,6 +1835,19 @@ function get_object_subtype( $object_type, $object_id ) {

 			$object_subtype = 'user';
 			break;
+
+		case 'blog':
+			if ( ! is_multisite() || $object_id <= 0 ) {
+				break;
+			}
+
+			$site = get_site( $object_id );
+			if ( ! $site ) {
+				break;
+			}
+
+			$object_subtype = 'blog';
+			break;
 	}

 	/**
diff --git a/wp-includes/ms-site.php b/wp-includes/ms-site.php
index 6399dab72e..65f5259fe1 100644
--- a/wp-includes/ms-site.php
+++ b/wp-includes/ms-site.php
@@ -1129,6 +1129,32 @@ function delete_site_meta_by_key( $meta_key ) {
 	return delete_metadata( 'blog', null, $meta_key, '', true );
 }

+/**
+ * Registers a meta key for sites.
+ *
+ * @since 7.2.0
+ *
+ * @param string $meta_key The meta key to register.
+ * @param array  $args     Data used to describe the meta key when registered. See
+ *                         {@see register_meta()} for a list of supported arguments.
+ * @return bool True if the meta key was successfully registered, false if not.
+ */
+function register_site_meta( $meta_key, array $args ) {
+	return register_meta( 'blog', $meta_key, $args );
+}
+
+/**
+ * Unregisters a meta key for sites.
+ *
+ * @since 7.2.0
+ *
+ * @param string $meta_key The meta key to unregister.
+ * @return bool True on success, false if the meta key was not previously registered.
+ */
+function unregister_site_meta( $meta_key ) {
+	return unregister_meta_key( 'blog', $meta_key );
+}
+
 /**
  * Updates the count of sites for a network based on a changed site.
  *
diff --git a/wp-includes/version.php b/wp-includes/version.php
index b6b2f35e1a..9595e9f257 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-63602';
+$wp_version = '7.2-alpha-63603';

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