Skip to content

[multisite] Improve retrieval of individual‑site info in a multisite … #802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2025

Conversation

fajardoleo
Copy link
Contributor

…network.

@fajardoleo fajardoleo self-assigned this May 18, 2025
@fajardoleo fajardoleo force-pushed the feature/leo/multisite-site-info-enhancements branch 3 times, most recently from e62f937 to 2f18daa Compare July 10, 2025 14:56
public function remove( $hook ) {
global $wp_filter;

if ( isset( $wp_filter[ $hook ] ) ) {
Copy link
Collaborator

@DanieleAlessandra DanieleAlessandra Jul 14, 2025

Choose a reason for hiding this comment

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

In normal WP context this is good enough, but in edge cases it could be useful to safe check the existence of $wp_filter:

if ( isset( $wp_filter ) && isset( $wp_filter[ $hook ] ) ) {

This makes the code more robust in edge cases, such as when the file is loaded outside of the standard WordPress environment or during automated tests.
In normal WordPress usage, this is rarely necessary, but it helps prevent potential errors in atypical scenarios.

Copy link
Collaborator

@DanieleAlessandra DanieleAlessandra left a comment

Choose a reason for hiding this comment

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

The changes look good enough to me, only read the one comment and think about it (we have to deal with tons of different use cases).

@fajardoleo fajardoleo force-pushed the feature/leo/multisite-site-info-enhancements branch from 2f18daa to 99d55b6 Compare July 14, 2025 15:37
Copy link
Contributor

@swashata swashata left a comment

Choose a reason for hiding this comment

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

Please see my only question

@@ -7897,18 +7897,20 @@ private function activate_bundle_license( $license, $sites = array(), $current_b
}
}

$current_blog_id = get_current_blog_id();
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not fully aware of the mechanism, but don't we want to call this before even switching on line 7854?

@@ -15832,9 +15833,8 @@ function get_site_info( $site = null, $load_registration = false ) {
$info[ 'registration_date' ] = $registration_date;
}

if ( $switched ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@fajardoleo why are we removing this? Don't we want to restore the blog like before?

…ure/swas/restore_blog_fix_alt_exploration` branch.
@fajardoleo fajardoleo force-pushed the feature/leo/multisite-site-info-enhancements branch from 99d55b6 to a8e7e4b Compare July 23, 2025 14:26
Copy link
Contributor

@swashata swashata left a comment

Choose a reason for hiding this comment

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

Nice addition

@fajardoleo fajardoleo merged commit a75b873 into develop Jul 24, 2025
5 checks passed
@fajardoleo fajardoleo deleted the feature/leo/multisite-site-info-enhancements branch July 24, 2025 07:27
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.

3 participants