WordPress / wporg-main-2022

A block-based child theme for WordPress.org, plus local environment
65 stars 26 forks source link

Theme Switcher: Default to using the redesigned theme for pages #313

Closed ryelle closed 1 year ago

ryelle commented 1 year ago

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.

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:

  1. Check out the branch, test locally or sync to sandbox (mu-plugins/main-network/theme-switcher.php)
  2. Try visiting any of the example URLs
  3. The page should load the new theme and show the correct content
  4. Try other valid pages, they should continue to work
  5. Visit /hosting/ or another "old theme" page
  6. It should still use the old theme & content
ryelle commented 1 year ago

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.