Skip to content

Meta: Add support for site meta in get_object_subtype()#12612

Draft
SainathPoojary wants to merge 4 commits into
WordPress:trunkfrom
SainathPoojary:fix/44387
Draft

Meta: Add support for site meta in get_object_subtype()#12612
SainathPoojary wants to merge 4 commits into
WordPress:trunkfrom
SainathPoojary:fix/44387

Conversation

@SainathPoojary

Copy link
Copy Markdown

Trac ticket: #44387

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copilot AI review requested due to automatic review settings July 21, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the metadata API’s get_object_subtype() to recognize multisite “site meta” objects (meta type 'blog'), enabling subtype-aware behavior for site meta and adding PHPUnit coverage for the new behavior.

Changes:

  • Add a 'blog' branch to get_object_subtype() that returns 'blog' for valid sites on multisite installs.
  • Update meta registration tests to create/delete a site in multisite and add new multisite-only assertions for blog/site subtype handling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/wp-includes/meta.php Adds 'blog' handling to get_object_subtype() by checking multisite and validating the site via get_site().
tests/phpunit/tests/meta/registerMeta.php Adds multisite setup/teardown for a created site and new tests targeting subtype behavior for 'blog' meta.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/phpunit/tests/meta/registerMeta.php Outdated
Comment thread tests/phpunit/tests/meta/registerMeta.php
Copilot AI review requested due to automatic review settings July 21, 2026 15:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread src/wp-includes/meta.php
Comment on lines +1838 to +1846
case 'blog':
if ( ! is_multisite() ) {
break;
}

$site = get_site( $object_id );
if ( ! $site ) {
break;
}
Comment on lines +1129 to +1131
public function test_get_object_subtype_for_blog_returns_empty_string_for_invalid_site() {
$this->assertSame( '', get_object_subtype( 'blog', 999999 ) );
}
Copilot AI review requested due to automatic review settings July 21, 2026 15:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/wp-includes/meta.php
Comment on lines 1789 to 1793
* Returns the object subtype for a given object ID of a specific type.
*
* @since 4.9.8
* @since 6.X.0 Added support for 'blog' object type in multisite.
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants