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

Clear stylesheet and template cache when switching sites #5532

Closed
wants to merge 4 commits into from

Conversation

jeremyfelt
Copy link
Member

This nulls the global wp_template_path and wp_stylesheet_path data whenever a site is switched or restored so that the next call to get_stylesheet_directory() or get_template_directory() will provide fresh data.

See https://core.trac.wordpress.org/ticket/59677

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


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.

This nulls the global `wp_template_path` and `wp_stylesheet_path`
data whenever a site is switched or restored so that the next
call to `get_stylesheet_directory()` or `get_template_directory()`
will provide fresh data.

See https://core.trac.wordpress.org/ticket/59677
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@jeremyfelt This solution looks great, including the tests!

Only minor nit-pick feedback on test skipping and test annotations per recent conventions.

tests/phpunit/tests/theme.php Outdated Show resolved Hide resolved
tests/phpunit/tests/theme.php Outdated Show resolved Hide resolved
tests/phpunit/tests/theme.php Outdated Show resolved Hide resolved
tests/phpunit/tests/theme.php Outdated Show resolved Hide resolved
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

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

Thanks @jeremyfelt! The solution looks good to me too, I just see a couple of minor docs updates to do. Pre-approving as I'm currently on vacation and unlikely to get a chance to review again before this is committed.

tests/phpunit/tests/theme.php Outdated Show resolved Hide resolved
src/wp-includes/ms-blogs.php Show resolved Hide resolved
@felixarntz
Copy link
Member

@felixarntz felixarntz closed this Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants