-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix admin styles #4727
Fix admin styles #4727
Conversation
@@ -408,7 +408,7 @@ function wp_theme_has_theme_json() { | |||
} | |||
|
|||
// Does the theme have its own theme.json? | |||
$theme_has_support = is_readable( get_theme_file_path( 'theme.json' ) ); | |||
$theme_has_support = is_readable( wp_get_theme()->get_file_path( 'theme.json' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function get_theme_file_path
does not exist in script-loader.php
I've applied this patch to $theme_has_support = is_readable( get_stylesheet_directory() . '/theme.json' );
// Look up the parent if the child does not have a theme.json.
if ( ! $theme_has_support ) {
$theme_has_support = is_readable( get_template_directory() . '/theme.json' );
} |
Thanks! Doesn't seem to fix the issue for me, it then fails with a similar but different error:
Pinging @azaozz for advice 🙂 |
@SergeyBiryukov @joemcgill Moving this function seems to work for me. I am not sure about moving functions like this. I don't see the harm personally, but want to check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a clever workaround. This is loaded early enough that it should be fine, but would be good to do some extra testing.
This function is a part of a larger set:
Moving them to
But in that case, all four should be moved, not just one 🙂 |
I agree, I these should live theme.php. Should I move them @SergeyBiryukov ? |
The main risk in moving functions is that someone is doing a check to see if those functions are loaded, and if not, are manually requiring the original file, ex: if ( ! function_exists( 'get_theme_file_path' ) {
require require ABSPATH . WPINC . '/link-template.php';
}
$theme_path = get_theme_file_path( $path ); By moving these functions, code doing something like ☝🏻 will now fatal. I don't see examples of this in the wild, but the safest way to handle this is to wrap the places where we're moving functions with a similar |
IMO, moving additional functions can be a follow-up task, since this is needed to unblock the 6.3-beta1 release. |
I was just searching that now. https://www.wpdirectory.net/search/01H3ZBHTNVSS5ZWW91ZXXGEE7J. I can't see any examples. |
After looking at this again. I am not sure about moving all these functions. I think the path based function make sense. But link based function should remain in link-template.php |
I think so 🙂
There are a few other theme-related
So I would say I think I would prefer moving them all in one go, though moving the additional functions in a follow-up commit might also be an option. On a related note, |
@SergeyBiryukov @joemcgill I have another solution that doesn't involve moving the functions. |
Trac ticket: https://core.trac.wordpress.org/ticket/57629
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.