Skip to content
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

404: Pass correct get_site_url param to avoid infinite loop #98

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

iandunn
Copy link
Member

@iandunn iandunn commented Aug 21, 2023

The first param to get_site_url() should be a site ID, or null for the current site. Passing a string can cause a switch_to_blog( 0 ) in some circumstances. That breaks SQL queries because the table doesn't exist. The first broken query results in a wp_die(), but that leads to more queries which in turn call wp_die().

Passing null fixes the error while preserving the original intent from #54 (comment).

I ran into this while trying to activate the parent theme on events.wordpress.org for WordPress/wordcamp.org#1007

The first param to `get_site_url()` should be a site ID, or `null` for the current site. Passing a string can cause a `switch_to_blog( 0 )` in some circumstances. That breaks SQL queries because the table doesn't exist. The first broken query results in a `wp_die()`, but that leads to more queries which in turn call `wp_die()`.

Passing `null` fixes the error while preserving the original intent from #54 (comment).
@iandunn iandunn requested a review from renintw August 21, 2023 21:39
@iandunn iandunn self-assigned this Aug 21, 2023
@iandunn iandunn added [Type] Bug Something isn't working [Component] Theme Templates, patterns, CSS labels Aug 21, 2023
Copy link
Contributor

@renintw renintw left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and the insight. Look good to me 👍

@iandunn iandunn merged commit d75152c into trunk Aug 22, 2023
@iandunn iandunn deleted the 404-infinite-loop branch August 22, 2023 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Theme Templates, patterns, CSS [Type] Bug Something isn't working
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants