[wp-trac] [WordPress Trac] #59847: Since WordPress 6.4, the functions.php of a theme moved to a different location using register_theme_directory is no longer called
WordPress Trac
noreply at wordpress.org
Wed Nov 8 23:00:40 UTC 2023
#59847: Since WordPress 6.4, the functions.php of a theme moved to a different
location using register_theme_directory is no longer called
-----------------------------+------------------------------------
Reporter: partyfrikadelle | Owner: joemcgill
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: Awaiting Review
Component: Bootstrap/Load | Version: 6.4
Severity: critical | Resolution:
Keywords: | Focuses: template, performance
-----------------------------+------------------------------------
Comment (by kdowns):
I am noting this same issue but slightly different context.
I have a plugin that hooks `stylesheet_directory` filter to pass in a
custom value. The hook fires on `plugins_loaded` and generally works with
a couple of exceptions.
The issue is noted any time `$wp_stylesheet_path` is defined before my
filter can be applied which results in `$stylesheet_dir = apply_filters(
'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );`
becoming unreachable.
This can occur if `$wp_stylesheet_path` ends up being called and defined
by translations or a different plugin based on plugin load priority.
Test case example 1, I have a WordPress site running a French translation.
The translations load prior to `plugins_loaded` which results in
`$wp_stylesheet_path` being defined before my filter can be applied. This
results in the inability to apply my filter.
Test case example 2, my plugin is named B-example.php and contains hooks
into the `stylesheet_directory` filter. I also have plugin A-example.php
active which through some form or another results in
`get_stylesheet_directory()` being called which in turn will define
`$wp_stylesheet_path`. Because plugin A is loaded first due to naming
order,`$wp_stylesheet_path` is defined before plugin B can fire it's hook
to add it's filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59847#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list