Make WordPress Core


Ignore:
Timestamp:
09/11/2026 04:50:51 PM (24 hours ago)
Author:
spacedmonkey
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/meta.php

    r63497 r63603  
    17901790 *
    17911791 * @since 4.9.8
     1792 * @since 7.2.0 Added support for 'blog' object type in multisite.
    17921793 *
    17931794 * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
     
    18351836                        $object_subtype = 'user';
    18361837                        break;
     1838
     1839                case 'blog':
     1840                        if ( ! is_multisite() || $object_id <= 0 ) {
     1841                                break;
     1842                        }
     1843
     1844                        $site = get_site( $object_id );
     1845                        if ( ! $site ) {
     1846                                break;
     1847                        }
     1848
     1849                        $object_subtype = 'blog';
     1850                        break;
    18371851        }
    18381852
Note: See TracChangeset for help on using the changeset viewer.