[wp-trac] [WordPress Trac] #60025: Changeset 57156 breaks themes that relied on update_option( 'stylesheet', '...' )
WordPress Trac
noreply at wordpress.org
Tue Jan 23 21:37:01 UTC 2024
#60025: Changeset 57156 breaks themes that relied on update_option( 'stylesheet',
'...' )
-------------------------------------+------------------------
Reporter: blindmikey | Owner: joemcgill
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 6.4.3
Component: Themes | Version: 6.4.2
Severity: critical | Resolution:
Keywords: needs-patch 2nd-opinion | Focuses:
-------------------------------------+------------------------
Changes (by joemcgill):
* keywords: needs-patch close => needs-patch 2nd-opinion
Comment:
After testing the latest iteration on [https://github.com/WordPress
/wordpress-develop/pull/5926#issuecomment-1906795872 this PR] for #60290.
I believe the same approach will fix this issue as well.
To test, here's an improved snippet that you can add to a theme's
index.php file from what I provided earlier
{{{#!php
<?php
$theme_base = wp_basename( __DIR__ );
$template_path = "$theme_base/templates";
// Set the template path option to a different location.
update_option( 'template', $template_path );
// Filter `get_template()` back to the theme root.
add_filter('template', function () use ( $theme_base ) {
return $theme_base;
});
}}}
With this, you can add a new directory named "templates" to your theme
root and add a template file, like `home.php` (for the homepage) and see
that in the 6.3 branch when visiting the homepage, that the template from
the subdirectory would be loaded, but in 6.4 it will not. However, with
[https://github.com/WordPress/wordpress-
develop/pull/5926#issuecomment-1906795872 this PR] applied, the previous
behavior is restored.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60025#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list