Hey Luke,
I went down the rabbit hole today and figured out what is causing this issue: a non-typical WordPress folder structure.
I use Bedrock. Bedrock rearranges the WordPress file system. The WP_CONTENT_DIR is the /app folder, and WordPress core files go in a /wp folder.
I went into the core wp_enqueue_style function and printed out the WP_Styles Object. An example:
[genesis-custom-blocks-editor-css] => _WP_Dependency Object
(
[handle] => genesis-custom-blocks-editor-css
[src] => https://genesis.local/app/plugins/genesis-custom-blocks-pro/vendor/studiopress/genesis-custom-blocks/css/blocks.editor.css
[deps] => Array
(
)
[ver] => 78af8c18648205f9991d20eb79a727f9
[args] => all
[extra] => Array
(
)
[textdomain] =>
[translations_path] =>
)
[genesis-custom-blocks__block-fancy-text] => _WP_Dependency Object
(
[handle] => genesis-custom-blocks__block-fancy-text
[src] => /app/themes/twentytwentyone/blocks/fancy-text/preview.css
[deps] => Array
(
)
[ver] => 1.2
[args] => all
[extra] => Array
(
)
[textdomain] =>
[translations_path] =>
)
The [src] of the genesis-custom-blocks-editor-css is a full URL. That works. The [src] to my custom block preview.css is not a full URL. Now, the URL isn’t incorrect per se, but WordPress in Bedrock is looking for it in the wrong place. wp_enqueue_styles is looking for /app in the same place that /wp-admin, /wp-content, and /wp-includes live. But that is the /wp folder in Bedrock. That is not where the /app folder is.
When I manually go into the core enqueue function and add https://genesis.local
to the beginning of the [src] for that one block preview.css file, it loads perfectly.
I’m not sure if there is a way for you to get get_template_directory_uri() somehow built into how these editor style paths are created, but I think that may be a solution for everyone. Right now I’m going to try to just build my own editor styles enqueue function that will add the styles with my paths.
Hopefully this helps you, or someone else in the future!
-
This reply was modified 3 years, 11 months ago by
app1e5auce.
-
This reply was modified 3 years, 11 months ago by
app1e5auce.
-
This reply was modified 3 years, 11 months ago by
app1e5auce.