Multisite: Deprecate get_blogaddress_by_id() function#8659
Multisite: Deprecate get_blogaddress_by_id() function#8659Sukhendu2002 wants to merge 2 commits into
Conversation
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
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 Unlinked AccountsThe 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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| 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 ); |
There was a problem hiding this comment.
Could we just use set_url_scheme here?
There was a problem hiding this comment.
Yes, using set_url_scheme() is definitely the better approach here. I have updated the code accordingly.
spacedmonkey
left a comment
There was a problem hiding this comment.
LGTM. This should be committed in WP 6.9
| // 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 ); |
There was a problem hiding this comment.
set_url_scheme() function will automatically replace this initial scheme with 'https://' when appropriate - specifically when is_ssl() returns true.
39f1f1a to
9dbf900
Compare
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.