Enqueued CSS – link output drops a slash?
-
Hey folks,
I’m having this weird issue, and I’m hoping someone has some insight into what the problem might be.
I’m trying to add a style sheet to our admin panel. I’ve done this successfully on a few sites, but lately code I’ve been using is failing.
This is what I’m inserting into our functions.php file:
// ADD CUSTOM STYLES TO ADMIN DASHBOARD function registerAdminCss() { wp_register_script('adminCss', '/bin/themes/custom/admin.css'); wp_enqueue_style('adminCss', '/bin/themes/custom/admin.css', array(), false, false); } add_action('admin_head', 'registerAdminCss');
And this is what’s being output into the dashboard (domain name removed):
<link rel='stylesheet' id='adminCss-css' href='https://www.domain.com/bin/themes/customadmin.css?ver=4.6.1' type='text/css' media='' />
There are two issues:
1) The slash is missing here: “custom/admin.css” (note that the output code shows “customadmin.css”
2) I expected this would place the file into the <head></head>, since we’re hooking it into admin_head, but it’s actually placed at the bottom of the source code.Issue #2 isn’t a big problem. The style sheet will (probably) still work. But it’s never going to work with the URL being output incorrectly.
What am I not seeing here? Any help would be most appreciated!
- The topic ‘Enqueued CSS – link output drops a slash?’ is closed to new replies.