Stop loading stylesheets out of the theme's directory - #43
Merged
Conversation
The plugin pulled two stylesheets from wherever Shapely happened to be
installed, using get_template_directory_uri():
assets/css/font-awesome.min.css
inc/libraries/epsilon-framework/assets/css/style.css
Shapely removed the first in 1.2.21 when it moved to Font Awesome 6, and the
second in 1.3.0 when the vendored Epsilon framework was retired. Both therefore
404 on the widgets and customizer screens. The font-awesome one is already
failing against the released 1.2.21.
Neither is fatal and neither affects visitors -- both are admin-only, one behind
is_admin() and the other only on widgets.php and customize.php -- but a plugin
reaching into a theme's internal file layout is the coupling that made this
break in the first place.
Font Awesome now points at the theme's current copy, under our own handle
rather than the generic 'font-awesome' (which can suppress another copy already
registered on the page), and only when the file is actually present. The widget
forms work without it; the icon previews simply render blank.
The Epsilon stylesheet enqueue is removed outright, along with the now-empty
enqueue() methods and the admin_init / customize_controls_enqueue_scripts /
customize_preview_init hooks that pointed at them.
Verified on WordPress 7.0.3 / PHP 8.5.3: the admin screens that previously
logged two 404s now load with none.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while testing Shapely 1.3.0 on a real install.
The plugin loaded two stylesheets from wherever the theme happened to be installed:
assets/css/font-awesome.min.cssinc/libraries/epsilon-framework/assets/css/style.cssBoth 404 on
widgets.phpandcustomize.php.Severity: admin-only and cosmetic. One is behind
is_admin(), the other only fires on the widgets and customizer screens. No fatal, nothing visitor-facing. But a plugin reaching into a theme's internal file layout is exactly the coupling that caused the break, so the fix is to stop doing it rather than to chase the paths.Changes
shapely-companion-font-awesomerather than the genericfont-awesomehandle — which can suppress another copy already registered on the page — and only when the file is actually present. The widget forms work without it; icon previews just render blank.enqueue()methods and theadmin_init/customize_controls_enqueue_scripts/customize_preview_inithooks that called them.Verified
WordPress 7.0.3 / PHP 8.5.3. The admin screens that previously logged two 404s now load with none, and the full admin sweep passes with 0 fatals and 0 console errors.