Title: Should use wp_enqueue_style
Last modified: August 20, 2016

---

# Should use wp_enqueue_style

 *  [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/should-use-wp_enqueue_style/)
 * instead of
 *     ```
       // Add a header hook so we can link to a CSS file
       add_action('wp_head', 'most_shared_posts_head');
   
       // Our header function which'll hook in our CSS file
       function most_shared_posts_head() {
       	echo '<link rel="stylesheet" type="text/css" href="' . plugins_url('most-shared-posts.css', __FILE__). '">';
       }
       ```
   
 * shouldn’t you use
 *     ```
       // Add a header hook so we can link to a CSS file
       add_action('wp_enqueue_scripts', 'most_shared_posts_style');
   
       // Our header function which'll hook in our CSS file
       function most_shared_posts_style() {
       	wp_enqueue_style( 'most-shared-posts', plugins_url('most-shared-posts.css', __FILE__) );
       }
       ```
   
 * [http://wordpress.org/extend/plugins/most-shared-posts/](http://wordpress.org/extend/plugins/most-shared-posts/)

The topic ‘Should use wp_enqueue_style’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/most-shared-posts.svg)
 * [Most Shared Posts - Social Media counter for Twitter, Facebook & Google+](https://wordpress.org/plugins/most-shared-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/most-shared-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/most-shared-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/most-shared-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/most-shared-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/most-shared-posts/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/should-use-wp_enqueue_style/)
 * Status: not resolved