Title: Action: &#8216;wp_enqueue_scripts&#8217; does not output the link
Last modified: June 30, 2018

---

# Action: ‘wp_enqueue_scripts’ does not output the link

 *  [pagemaecker](https://wordpress.org/support/users/pagemaecker/)
 * (@pagemaecker)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/)
 * Registering the style in a plugin should produces this output:
    <link rel=’stylesheet’
   id=’bs-style-css’ href=’[http://localhost:3000/wp/wp-content/plugins/bootstrap-login/css/bs-style.css?ver=20120208&#8242](http://localhost:3000/wp/wp-content/plugins/bootstrap-login/css/bs-style.css?ver=20120208&#8242);
   type=’text/css’ media=’all’ />
 * But it does not!
 * This is my code:
 *     ```
       add_action( 'wp_enqueue_scripts', 'wpbootstrap_css_styles' );
   
       function wpbootstrap_css_styles() {
          // Register the style for the plugin:
          wp_register_style( 'bs-style', 
       	    	      plugins_url( '/css/bs-style.css', __FILE__ ), 
       	    	      array(), '20180620', 'all' );
           wp_enqueue_style( 'bs-style' );
       }
       ```
   
 * What am I doing wrong, not enough or what?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10450922)
 * Placing you code in my site specific plugin produces the expected output, there’s
   nothing wrong with your code, it’s something else. Caching in place? Minifying
   or optimizing code present?
 *  Thread Starter [pagemaecker](https://wordpress.org/support/users/pagemaecker/)
 * (@pagemaecker)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10450928)
 * Excellent, thanks for testing.
    Where did you put the code; I put mine in the“
   main” file of my plugin. And, as I said, nothing happend.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10452458)
 * Yup, same here. It’s my plugin’s only file. Naturally the CSS was not applied
   since the file is missing on my site, but the expected link tag was output. If
   none of the previously mentioned reasons do not explain things, there could be
   a plugin or theme conflict of some sort. If you switched to a twenty* default
   theme and deactivated all other plugins, your CSS file should be referenced.
 *  Thread Starter [pagemaecker](https://wordpress.org/support/users/pagemaecker/)
 * (@pagemaecker)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10452787)
 * Thanks for your help.
    My bad is that I commented out wp_head() in the header.
   There is just a lot of unwanted s… in there. Is there a way to eat my cake and
   still have it?
 *  Thread Starter [pagemaecker](https://wordpress.org/support/users/pagemaecker/)
 * (@pagemaecker)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10454139)
 * It is possible to eat my cake and still have it!
 * In the dedicated header file of the plugin I put this code:
 *     ```
          <link href="<?php echo plugins_url( '/css/bs-style.css' ); ?>" rel="stylesheet" />
       ```
   
 * which produces this output:
    <link href=”[http://localhost:3000/wp/wp-content/plugins/css/bs-style.css&#8221](http://localhost:3000/wp/wp-content/plugins/css/bs-style.css&#8221);
   rel=”stylesheet”>
 * Just what I want!
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10455269)
 * That’s fine for your own site, but it’s considered incorrect practice for plugins,
   especially those destined for the repository. Just sayin’. FYI: if you wanted
   to be proper and wp_head() is causing undesirable output, try calling `apply_filters('
   wp_head');` instead to get enqueued stylesheets referenced. If that still causes
   undesirable output, you could dequeue anything hooked to the wp_head action.
 * This ability to manage output through enqueue and dequeue without altering template
   code in largely the reason for enqueuing CSS (and scripts as well). It also allows
   us and WP to manage in what order things are referenced, sometimes very important.
 * Anyway, I’m glad you found a solution that works for you.
 *  Thread Starter [pagemaecker](https://wordpress.org/support/users/pagemaecker/)
 * (@pagemaecker)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10455631)
 * Great! That points me to the direction.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Action: ‘wp_enqueue_scripts’ does not output the link’ is closed to new
replies.

## Tags

 * [wp_enqueue_scripts](https://wordpress.org/support/topic-tag/wp_enqueue_scripts/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 7 replies
 * 2 participants
 * Last reply from: [pagemaecker](https://wordpress.org/support/users/pagemaecker/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/action-wp_enqueue_scripts-does-not-output-the-link/#post-10455631)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
