Skip to content

Multisite: Deprecate get_blogaddress_by_id() function#8659

Open
Sukhendu2002 wants to merge 2 commits into
WordPress:trunkfrom
Sukhendu2002:deprecate/37297-get-blogaddress-by-id
Open

Multisite: Deprecate get_blogaddress_by_id() function#8659
Sukhendu2002 wants to merge 2 commits into
WordPress:trunkfrom
Sukhendu2002:deprecate/37297-get-blogaddress-by-id

Conversation

@Sukhendu2002
Copy link
Copy Markdown

@Sukhendu2002 Sukhendu2002 commented Apr 7, 2025

Trac ticket: https://core.trac.wordpress.org/ticket/37297

This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2025

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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • 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.

@Sukhendu2002 Sukhendu2002 marked this pull request as ready for review April 7, 2025 10:40
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @jonnynews.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sukhendu2002, spacedmonkey, mukesh27.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment thread src/wp-includes/ms-deprecated.php Outdated
if ( ! empty( $site_info ) ) {
$scheme = parse_url( $site_info->home, PHP_URL_SCHEME );
$scheme = empty( $scheme ) ? 'http' : $scheme;
$url = esc_url( $scheme . '://' . $site_info->domain . $site_info->path );
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we just use set_url_scheme here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, using set_url_scheme() is definitely the better approach here. I have updated the code accordingly.

Copy link
Copy Markdown
Member

@spacedmonkey spacedmonkey left a comment

Choose a reason for hiding this comment

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

LGTM. This should be committed in WP 6.9

Comment thread src/wp-includes/ms-deprecated.php Outdated
// Get the site URL directly from get_site() instead of using get_blogaddress_by_id().
$site_info = get_site( $blog_id );
if ( ! empty( $site_info ) ) {
$url = set_url_scheme( 'http://' . $site_info->domain . $site_info->path );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about https?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

set_url_scheme() function will automatically replace this initial scheme with 'https://' when appropriate - specifically when is_ssl() returns true.

@Sukhendu2002 Sukhendu2002 force-pushed the deprecate/37297-get-blogaddress-by-id branch from 39f1f1a to 9dbf900 Compare May 29, 2026 07:16
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.

4 participants