This will reverse the logic for loading the redesign theme, so that pages are opted-out of the new theme, rather than opted in. It also makes the page check case-insensitive. This fixes some edge cases where technically-valid page URLs are used, but the theme switcher fails to load the correct template.
For example, the following URLs should now load the correct theme & content.
Capitalized slugs: wordpress.org/About (or Blocks, as the original issue found, but there's a workaround for that page in place now)
Slugs with dots: wordpress.org/download/releases/6.3/ (IIRC this was reported in slack but not followed up on)
More dots: wordpress.org/download/beta....nightly/
Ideally these URLs should redirect to the real canonical URL, but since they are functional links, the theme should at least not be broken. There are core tickets for the arbitrary dashes and dots in permalinks (which also applies to the 6.3 issue despite seeming related to the post title).
Good idea, that does simplify the function. Looks like we don't need the search one, but I kept preview so that those links will always use the new theme.
This will reverse the logic for loading the redesign theme, so that pages are opted-out of the new theme, rather than opted in. It also makes the page check case-insensitive. This fixes some edge cases where technically-valid page URLs are used, but the theme switcher fails to load the correct template.
For example, the following URLs should now load the correct theme & content.
wordpress.org/About
(or Blocks, as the original issue found, but there's a workaround for that page in place now)wordpress.org/download/releases/6.3/
(IIRC this was reported in slack but not followed up on)wordpress.org/download/beta----nightly/
wordpress.org/download/beta....nightly/
Ideally these URLs should redirect to the real canonical URL, but since they are functional links, the theme should at least not be broken. There are core tickets for the arbitrary dashes and dots in permalinks (which also applies to the 6.3 issue despite seeming related to the post title).
See https://github.com/WordPress/wporg-main-2022/issues/245#issuecomment-1675270164, https://meta.trac.wordpress.org/ticket/7204
How to test the changes in this Pull Request:
mu-plugins/main-network/theme-switcher.php
)/hosting/
or another "old theme" page