Plugin throws up 404 on front-end when when enqueuing style with filetime
Question
I’m building a very simple plugin to add social media icons to each page on a site that I’m working on.
I was expecting the following code to enqueue a stylesheet on the front-end:
function myplugin_styles_scripts() {
wp_enqueue_style( 'myplugin-style', plugin_dir_path( __FILE__ ) . '/css/style.css', array(), filemtime( plugin_dir_path( __FILE__ ) . '/css/style.css' ) );
}
add_action( 'wp_enqueue_scripts', 'myplugin_styles_scripts' );
On the front-end, I get the following error in the console:
https://testing.local/app/public/wp-content/plugins/social-icons/css/style.css?ver=1583931475
net::ERR_ABORTED 404
The directory and file exist within my plugin. What’s causing this?
0
plugins, wp-enqueue-style
4 years
2020-03-11T08:50:57-05:00
2020-03-11T08:50:57-05:00 0 Answers
100 views
0
Leave an answer