forked from mfields/Taxonomy-Images
-
Notifications
You must be signed in to change notification settings - Fork 5
Resource loading outside of the WP plugins directory #35
Copy link
Copy link
Open
Description
I encountered a minor issue while directly integrating this plugin into a theme using Composer + WPackagist: admin-side resources (CSS/images) don't load properly, something I traced back to the taxonomy_image_plugin_url function. It turns out the core plugin_dir_path function returns a malformed URL (absolute URL + relative path) when the file calling it isn't in the WP plugins folder. An easy fix would be to add a filter to the taxonomy_image_plugin_url function... but for the time being, and in case anyone else encounters the issue, this little workaround seems to do the trick:
add_filter( 'plugins_url', function($url) {
if ( strpos($url, 'taxonomy-images') !== false )
return get_template_directory_uri() . '/vendor/wp-plugins/taxonomy-images/';
return $url;
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels