Title: wp_enqueue_style
Published: April 25, 2014
Last modified: August 20, 2026

---

# wp_enqueue_style( string $handle, string $src = '', string[] $deps = array(), string|bool|null $ver = false, string $media = 'all' )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#more-information)
    - [Usage](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#usage)
    - [Notes](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#notes)
 * [Source](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#wp--skip-link--target)

Enqueues a CSS stylesheet.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#description)󠁿

Registers the style if source provided (does NOT overwrite) and enqueues.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#see-also)󠁿

 * [WP_Dependencies::add()](https://developer.wordpress.org/reference/classes/WP_Dependencies/add/)
 * [WP_Dependencies::enqueue()](https://developer.wordpress.org/reference/classes/WP_Dependencies/enqueue/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#parameters)󠁿

 `$handle`stringrequired

Name of the stylesheet. Should be unique.

`$src`stringoptional

Full URL of the stylesheet, or path of the stylesheet relative to the WordPress 
root directory.

Default:`''`

`$deps`string[]optional

An array of registered stylesheet handles this stylesheet depends on.

Default:`array()`

`$ver`string|bool|nulloptional

String specifying stylesheet version number, if it has one, which is added to the
URL as a query string for cache busting purposes. If version is set to false, a 
version number is automatically added equal to current installed WordPress version.

If set to null, no version is added.

Default:`false`

`$media`stringoptional

The media for which this stylesheet has been defined.
 Default `'all'`. Accepts 
media types like `'all'`, `'print'` and `'screen'`, or media queries like ‘(orientation:
portrait)’ and ‘(max-width: 640px)’.

Default:`'all'`

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#more-information)󠁿

### 󠀁[Usage](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#usage)󠁿

A safe way to add/enqueue a stylesheet file to the WordPress generated page.

    ```php
    wp_enqueue_style( $handle, $src, $deps, $ver, $media );
    ```

### 󠀁[Notes](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#notes)󠁿

 * If you are going to use some [jQuery UI features](https://developer.wordpress.org/reference/functions/wp_enqueue_script/#defaults)
   you might have to provide your own CSS file: WordPress core does not have a full
   jQuery UI theme!
 * Default styles that are loaded via WordPress Core can be discerned via the source
   code on the [default styles](https://developer.wordpress.org/reference/functions/wp_default_styles/#source)
   page.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#source)󠁿

    ```php
    function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) {
    	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

    	$wp_styles = wp_styles();

    	if ( $src ) {
    		$_handle = explode( '?', $handle );
    		$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
    	}

    	$wp_styles->enqueue( $handle );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/functions.wp-styles.php#L173)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/functions.wp-styles.php#L173-L184)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_styles()](https://developer.wordpress.org/reference/functions/wp_styles/)`wp-includes/functions.wp-styles.php` |

Initializes $wp_styles if it has not been set.

  |

| Used by | Description | 
| [wp_enqueue_view_transitions_admin_css()](https://developer.wordpress.org/reference/functions/wp_enqueue_view_transitions_admin_css/)`wp-includes/view-transitions.php` |

Enqueues View Transitions CSS for the admin.

  | 
| [wp_options_connectors_wp_admin_enqueue_scripts()](https://developer.wordpress.org/reference/functions/wp_options_connectors_wp_admin_enqueue_scripts/)`wp-includes/build/pages/options-connectors/page-wp-admin.php` |

Enqueue scripts and styles for the options-connectors-wp-admin page.

  | 
| [wp_options_connectors_render_page()](https://developer.wordpress.org/reference/functions/wp_options_connectors_render_page/)`wp-includes/build/pages/options-connectors/page.php` |

Render the options-connectors page.

  | 
| [wp_font_library_render_page()](https://developer.wordpress.org/reference/functions/wp_font_library_render_page/)`wp-includes/build/pages/font-library/page.php` |

Render the font-library page.

  | 
| [wp_font_library_wp_admin_enqueue_scripts()](https://developer.wordpress.org/reference/functions/wp_font_library_wp_admin_enqueue_scripts/)`wp-includes/build/pages/font-library/page-wp-admin.php` |

Enqueue scripts and styles for the font-library-wp-admin page.

  | 
| [wp_enqueue_command_palette_assets()](https://developer.wordpress.org/reference/functions/wp_enqueue_command_palette_assets/)`wp-includes/script-loader.php` |

Enqueues the assets required for the Command Palette.

  | 
| [wp_render_empty_block_template_warning()](https://developer.wordpress.org/reference/functions/wp_render_empty_block_template_warning/)`wp-includes/block-template.php` |

Renders a warning screen for empty block templates.

  | 
| [WP_Interactivity_API::data_wp_router_region_processor()](https://developer.wordpress.org/reference/classes/wp_interactivity_api/data_wp_router_region_processor/)`wp-includes/interactivity-api/class-wp-interactivity-api.php` |

Processes the `data-wp-router-region` directive.

  | 
| [wp_enqueue_emoji_styles()](https://developer.wordpress.org/reference/functions/wp_enqueue_emoji_styles/)`wp-includes/formatting.php` |

Enqueues the important emoji-related styles.

  | 
| [wp_enqueue_embed_styles()](https://developer.wordpress.org/reference/functions/wp_enqueue_embed_styles/)`wp-includes/embed.php` |

Enqueues the CSS in the embed iframe header.

  | 
| [wp_enqueue_block_template_skip_link()](https://developer.wordpress.org/reference/functions/wp_enqueue_block_template_skip_link/)`wp-includes/theme-templates.php` |

Enqueues the skip-link styles.

  | 
| [WP_Duotone::output_footer_assets()](https://developer.wordpress.org/reference/classes/wp_duotone/output_footer_assets/)`wp-includes/class-wp-duotone.php` |

Outputs all necessary SVG for duotone filters, CSS for classic themes.

  | 
| [wp_enqueue_classic_theme_styles()](https://developer.wordpress.org/reference/functions/wp_enqueue_classic_theme_styles/)`wp-includes/script-loader.php` |

Loads classic theme styles when the current theme lacks a theme.json file.

  | 
| [wp_enqueue_stored_styles()](https://developer.wordpress.org/reference/functions/wp_enqueue_stored_styles/)`wp-includes/script-loader.php` |

Fetches, processes and compiles stored core styles, then combines and renders them to the page.

  | 
| [_wp_get_iframed_editor_assets()](https://developer.wordpress.org/reference/functions/_wp_get_iframed_editor_assets/)`wp-includes/block-editor.php` |

Collect the block editor assets that need to be loaded into the editor’s iframe.

  | 
| [_wp_theme_json_webfonts_handler()](https://developer.wordpress.org/reference/functions/_wp_theme_json_webfonts_handler/)`wp-includes/deprecated.php` |

Runs the theme.json webfonts handler.

  | 
| [wp_enqueue_global_styles_css_custom_properties()](https://developer.wordpress.org/reference/functions/wp_enqueue_global_styles_css_custom_properties/)`wp-includes/script-loader.php` |

Function that enqueues the CSS Custom Properties coming from theme.json.

  | 
| [wp_enqueue_block_style()](https://developer.wordpress.org/reference/functions/wp_enqueue_block_style/)`wp-includes/script-loader.php` |

Enqueues a stylesheet for a specific block.

  | 
| [wp_enqueue_editor_format_library_assets()](https://developer.wordpress.org/reference/functions/wp_enqueue_editor_format_library_assets/)`wp-includes/script-loader.php` |

Enqueues the assets required for the format library within the block editor.

  | 
| [wp_enqueue_global_styles()](https://developer.wordpress.org/reference/functions/wp_enqueue_global_styles/)`wp-includes/script-loader.php` |

Enqueues the global styles defined via theme.json.

  | 
| [WP_Block::render()](https://developer.wordpress.org/reference/classes/wp_block/render/)`wp-includes/class-wp-block.php` |

Generates the render output for the block.

  | 
| [wp_enqueue_editor_block_directory_assets()](https://developer.wordpress.org/reference/functions/wp_enqueue_editor_block_directory_assets/)`wp-includes/script-loader.php` |

Enqueues the assets required for the block directory within the block editor.

  | 
| [enqueue_block_styles_assets()](https://developer.wordpress.org/reference/functions/enqueue_block_styles_assets/)`wp-includes/script-loader.php` |

Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend.

  | 
| [wp_common_block_scripts_and_styles()](https://developer.wordpress.org/reference/functions/wp_common_block_scripts_and_styles/)`wp-includes/script-loader.php` |

Handles the enqueueing of block scripts and styles that are common to both the editor and the front-end.

  | 
| [wp_enqueue_registered_block_scripts_and_styles()](https://developer.wordpress.org/reference/functions/wp_enqueue_registered_block_scripts_and_styles/)`wp-includes/script-loader.php` |

Enqueues registered block scripts and styles, depending on current rendered context (only enqueuing editor scripts while in context of the editor).

  | 
| [register_and_do_post_meta_boxes()](https://developer.wordpress.org/reference/functions/register_and_do_post_meta_boxes/)`wp-admin/includes/meta-boxes.php` |

Registers the default post meta boxes, and runs the `do_meta_boxes` actions.

  | 
| [wp_enqueue_code_editor()](https://developer.wordpress.org/reference/functions/wp_enqueue_code_editor/)`wp-includes/general-template.php` |

Enqueues assets needed by the code editor for the given settings.

  | 
| [_WP_Editors::enqueue_default_editor()](https://developer.wordpress.org/reference/classes/_wp_editors/enqueue_default_editor/)`wp-includes/class-wp-editor.php` |

Enqueue all editor scripts.

  | 
| [WP_Widget_Media_Audio::enqueue_admin_scripts()](https://developer.wordpress.org/reference/classes/wp_widget_media_audio/enqueue_admin_scripts/)`wp-includes/widgets/class-wp-widget-media-audio.php` |

Loads the required media files for the media manager and scripts for media widgets.

  | 
| [WP_Widget_Media_Audio::enqueue_preview_scripts()](https://developer.wordpress.org/reference/classes/wp_widget_media_audio/enqueue_preview_scripts/)`wp-includes/widgets/class-wp-widget-media-audio.php` |

Enqueue preview scripts.

  | 
| [WP_Widget_Media_Video::enqueue_preview_scripts()](https://developer.wordpress.org/reference/classes/wp_widget_media_video/enqueue_preview_scripts/)`wp-includes/widgets/class-wp-widget-media-video.php` |

Enqueue preview scripts.

  | 
| [WP_Customize_Nav_Menus::enqueue_scripts()](https://developer.wordpress.org/reference/classes/wp_customize_nav_menus/enqueue_scripts/)`wp-includes/class-wp-customize-nav-menus.php` |

Enqueues scripts and styles for Customizer pane.

  | 
| [login_header()](https://developer.wordpress.org/reference/functions/login_header/)`wp-login.php` |

Outputs the login page header.

  | 
| [wp_dashboard_setup()](https://developer.wordpress.org/reference/functions/wp_dashboard_setup/)`wp-admin/includes/dashboard.php` |

Registers dashboard widgets.

  | 
| [WP_Internal_Pointers::enqueue_scripts()](https://developer.wordpress.org/reference/classes/wp_internal_pointers/enqueue_scripts/)`wp-admin/includes/class-wp-internal-pointers.php` |

Initializes the new feature pointers.

  | 
| [iframe_header()](https://developer.wordpress.org/reference/functions/iframe_header/)`wp-admin/includes/template.php` |

Generic Iframe header for use with Thickbox.

  | 
| [wp_iframe()](https://developer.wordpress.org/reference/functions/wp_iframe/)`wp-admin/includes/media.php` |

Outputs the iframe to display the media upload page.

  | 
| [Custom_Image_Header::css_includes()](https://developer.wordpress.org/reference/classes/custom_image_header/css_includes/)`wp-admin/includes/class-custom-image-header.php` |

Sets up the enqueue for the CSS files.

  | 
| [Custom_Background::admin_load()](https://developer.wordpress.org/reference/classes/custom_background/admin_load/)`wp-admin/includes/class-custom-background.php` |

Sets up the enqueue for the CSS & JavaScript files.

  | 
| [WP_Customize_Manager::customize_preview_init()](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_preview_init/)`wp-includes/class-wp-customize-manager.php` |

Prints JavaScript settings.

  | 
| [add_thickbox()](https://developer.wordpress.org/reference/functions/add_thickbox/)`wp-includes/general-template.php` |

Enqueues the default ThickBox js and css.

  | 
| [wp_admin_css()](https://developer.wordpress.org/reference/functions/wp_admin_css/)`wp-includes/general-template.php` |

Enqueues or directly prints a stylesheet link to the specified CSS file.

  | 
| [wp_auth_check_load()](https://developer.wordpress.org/reference/functions/wp_auth_check_load/)`wp-includes/functions.php` |

Loads the auth check for monitoring whether the user is still logged in.

  | 
| [WP_Admin_Bar::initialize()](https://developer.wordpress.org/reference/classes/wp_admin_bar/initialize/)`wp-includes/class-wp-admin-bar.php` |

Initializes the admin bar.

  | 
| [get_the_password_form()](https://developer.wordpress.org/reference/functions/get_the_password_form/)`wp-includes/post-template.php` |

Retrieves protected post password form content.

  | 
| [wp_enqueue_media()](https://developer.wordpress.org/reference/functions/wp_enqueue_media/)`wp-includes/media.php` |

Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs.

  | 
| [wp_video_shortcode()](https://developer.wordpress.org/reference/functions/wp_video_shortcode/)`wp-includes/media.php` |

Builds the Video shortcode output.

  | 
| [wp_playlist_scripts()](https://developer.wordpress.org/reference/functions/wp_playlist_scripts/)`wp-includes/media.php` |

Outputs and enqueues default scripts and styles for playlists.

  | 
| [wp_audio_shortcode()](https://developer.wordpress.org/reference/functions/wp_audio_shortcode/)`wp-includes/media.php` |

Builds the Audio shortcode output.

  | 
| [WP_Customize_Color_Control::enqueue()](https://developer.wordpress.org/reference/classes/wp_customize_color_control/enqueue/)`wp-includes/customize/class-wp-customize-color-control.php` |

Enqueue scripts/styles for the color picker.

  | 
| [WP_Customize_Widgets::enqueue_scripts()](https://developer.wordpress.org/reference/classes/wp_customize_widgets/enqueue_scripts/)`wp-includes/class-wp-customize-widgets.php` |

Enqueues scripts and styles for Customizer panel and export data to JavaScript.

  | 
| [_WP_Editors::enqueue_scripts()](https://developer.wordpress.org/reference/classes/_wp_editors/enqueue_scripts/)`wp-includes/class-wp-editor.php` |  |

[Show 47 more](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#user-contributed-notes)󠁿

 1.    [Skip to note 18 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-2056)
 2.     [Rob W](https://profiles.wordpress.org/robertark/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2056)
 3.   [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-2056)
      Vote results for this note: 21[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-2056)
 4.   For proper versioning based on the file’s last modified time, you can use something
      similar to:
 5.   `wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/style.css',
      array(), filemtime(get_template_directory() . '/css/style.css'), false);`
 6.   When the style.css file is updated on the server, WP will append the appropriate
      timestamp.
 7.   Note: You shouldn’t ever use time() as the 4th parameter or append it to the 
      file, as this will break caching in almost all cases.
 8.    * Shouldn’t the last parameter be set to “true” Otherwise it uses the wordpress
         current version instead of the file’s date
       * [Squidy McSquid](https://profiles.wordpress.org/x1-bot/) [7 years ago](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-3238)
       * The last parameter (false) is wrong, no boolean value accepted, it’s the “
         string $media” parameter, so either leave it out completely or define it properly.
       * [Jan Prazak](https://profiles.wordpress.org/amarok24/) [2 years ago](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-7260)
 9.    [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D2056%23feedback-editor-2056)
 10.   [Skip to note 19 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-340)
 11.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-340)
 12.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-340)
      Vote results for this note: 17[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-340)
 13.  **Using a Hook**
 14.  Scripts and styles from a single action hook
 15.      ```php
          /**
           * Proper way to enqueue scripts and styles
           */
          function wpdocs_theme_name_scripts() {
          	wp_enqueue_style( 'style-name', get_stylesheet_uri() );
          	wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
          }
          add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );
          ```
      
 16.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D340%23feedback-editor-340)
 17.   [Skip to note 20 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-341)
 18.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-341)
 19.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-341)
      Vote results for this note: 11[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-341)
 20.  **Load stylesheet only on a plugin’s options page:**
 21.      ```php
          /**
           * This example will work at least on WordPress 2.6.3, 
           * but maybe on older versions too.
           */
          add_action( 'admin_init', 'wpdocs_plugin_admin_init' );
          add_action( 'admin_menu', 'wpdocs_plugin_admin_menu' );
      
          /**
           * Register our stylesheet.
           */
          function wpdocs_plugin_admin_init() {
          	wp_register_style( 'wpdocsPluginStylesheet', plugins_url( 'stylesheet.css', __FILE__ ) );
          }
      
          /**
           * Register our plugin page and hook stylesheet loading.
           */
          function wpdocs_plugin_admin_menu() {
          	$page = add_submenu_page( 'edit.php', 
          		__( 'Wpdocs Plugin', 'textdomain' ), 
          		__( 'Wpdocs Plugin', 'textdomain' ),
          		'administrator',
          		__FILE__, 
          		'wpdocs_plugin_manage_menu' );
      
          	add_action( "admin_print_styles-{$page}", 'wpdocs_plugin_admin_styles' );
          }
      
          /**
           * Enqueue our stylesheet.
           */
          function wpdocs_plugin_admin_styles() {
          	wp_enqueue_style( 'wpdocsPluginStylesheet' );
          }
      
          /**
           * Output our admin page.
           */
          function wpdocs_plugin_manage_menu() {
          	 // ...
          }
          ```
      
 22.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D341%23feedback-editor-341)
 23.   [Skip to note 21 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-1968)
 24.    [gerardas](https://profiles.wordpress.org/gerardas/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-1968)
 25.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1968)
      Vote results for this note: 7[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1968)
 26.  **Override all stylesheets in queue**
 27.      ```php
          /* adds stylesheet file to the end of the queue */
          function wpdocs_override_stylesheets()
          {
              $dir = plugin_dir_url(__FILE__);
              wp_enqueue_style('theme-override', $dir . '/theme-overrides.css', array(), '0.1.0', 'all');
          }
          add_action('wp_enqueue_scripts', 'wpdocs_override_stylesheets', PHP_INT_MAX);
          ```
      
 28.   * Brilliant – in hindsight it seems obvious, of course. But this is a very useful
         way of making sure that your plugin’s CSS can succesfully override any theme’s
         CSS, without having to resort to labeling your entire CSS ‘`!important`‘. 
         One thing to consider though is that a value lower than `PHP_INT_MAX` would
         most likely suffice, leaving a possiblity for other plugins to in turn override
         your CSS.
       * [Bart Kuijper](https://profiles.wordpress.org/spartelfant/) [7 years ago](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-3694)
 29.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D1968%23feedback-editor-1968)
 30.   [Skip to note 22 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-2722)
 31.    [pawanwp](https://profiles.wordpress.org/pawanwp/)  [  8 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2722)
 32.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-2722)
      Vote results for this note: 6[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-2722)
 33.  Using this method you can enqueue a child theme’s style.css.
 34.      ```php
          function my_theme_enqueue_styles() {
      
              $parent_style = 'jobcareertheme';
      
              wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
              wp_enqueue_style( 'child-style',
                  get_stylesheet_directory_uri() . '/style.css',
                  array( $parent_style ),
                  wp_get_theme()->get('1.0.0')
              );
          }
          add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
          ```
      
 35.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D2722%23feedback-editor-2722)
 36.   [Skip to note 23 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-1246)
 37.    [alucard001](https://profiles.wordpress.org/alucard001/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-1246)
 38.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1246)
      Vote results for this note: 5[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1246)
 39.  How to remove `ver` in URL?
 40.  If you want to remove the `ver` parameter in URL (for example, to intentionally
      cache the file), you pass in `null` instead of false to remove that. For example:
 41.      ```php
          wp_enqueue_script('oxfam_js_cookie', 'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.0/js.cookie.min.js', array(), null, true);
          ```
      
 42.  By doing that, you will get:
 43.      ```javascript
          <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.0/js.cookie.min.js'></script>
          ```
      
 44.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D1246%23feedback-editor-1246)
 45.   [Skip to note 24 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-1570)
 46.    [Juhi Saxena](https://profiles.wordpress.org/juhise/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-1570)
 47.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1570)
      Vote results for this note: 5[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1570)
 48.  Enqueues should not be protocol specific, remove https. I have update code as
      below
 49.      ```php
          wp_enqueue_script('oxfam_js_cookie', '//cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.0/js.cookie.min.js', array(), null, true);
          ```
      
 50.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D1570%23feedback-editor-1570)
 51.   [Skip to note 25 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-5463)
 52.    [crstauf](https://profiles.wordpress.org/crstauf/)  [  5 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-5463)
 53.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-5463)
      Vote results for this note: 5[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-5463)
 54.  Note that Google Fonts has changed their URLs, so when embedding multiple font
      families only one will be loaded. The change is “fundamentally incompatible with
      how the rest of the world uses query variables and thus PHP itself”.
 55.  The fix is to set `null` on the `$version` parameter, which prevents the URL 
      from being parsed and the additional font families lost.
 56.  Trac ticket: [https://core.trac.wordpress.org/ticket/49742](https://core.trac.wordpress.org/ticket/49742)
 57.   * This helped me out of a jam, though if I can refine this answer a bit, this
         seems to only apply to the [Google Fonts CSS v2 API update](https://developers.google.com/fonts/docs/css2)(
         i.e. //fonts.googleapis.com/css2?). Google Fonts loaded with the previous 
         API (//fonts.googleapis.com/css?) will still work with a `$version` parameter
         other than `null`.
       * [John Sundberg](https://profiles.wordpress.org/bhwebworks/) [2 years ago](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-7096)
 58.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D5463%23feedback-editor-5463)
 59.   [Skip to note 26 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-1333)
 60.    [alordiel](https://profiles.wordpress.org/alordiel/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-1333)
 61.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1333)
      Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1333)
 62.  This is a conditional loading of css file by page template (css will be loaded
      on on the pages with tamplate-name.php).
       You can change the condition by another
      one. The code should be used in your theme’s function.php. **Notice**: The code
      works for child themes. If you want to use it in a parent theme replace `get_stylesheet_directory_uri()`
      with `get_stylesheet_uri()`.
 63.      ```php
          $handle = 'wpdocs';
          wp_register_style( $handle, get_stylesheet_directory_uri().'/relative/path/to/stylesheet.css', array(), '', true );
          if ( is_page_template( 'template-name.php' ) ) {
          	wp_enqueue_style( $handle );
          }
          ```
      
 64.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D1333%23feedback-editor-1333)
 65.   [Skip to note 27 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-2161)
 66.    [Anthony Hortin](https://profiles.wordpress.org/ahortin/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2161)
 67.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-2161)
      Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-2161)
 68.  See Also:
 69.  [wp_enqueue_script](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)
 70.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D2161%23feedback-editor-2161)
 71.   [Skip to note 28 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-3244)
 72.    [hongpong](https://profiles.wordpress.org/hongpong/)  [  7 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-3244)
 73.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-3244)
      Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-3244)
 74.  There are functions that can remove the version numbers after they are added 
      appropriately. look for
       `remove_query_arg` which can remove them and `script_loader_src`
      The hook that is often used to run this. A common symptom will be version numbers
      missing on all attached scripts and stylesheets.
 75.  For more info see [https://stackoverflow.com/questions/36805009/wordpress-css-and-js-version-numbers-not-working](https://stackoverflow.com/questions/36805009/wordpress-css-and-js-version-numbers-not-working)
 76.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D3244%23feedback-editor-3244)
 77.   [Skip to note 29 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-1453)
 78.    [montrealist](https://profiles.wordpress.org/spectrus/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-1453)
 79.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1453)
      Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-1453)
 80.  Load an IE-specific stylesheet:
 81.      ```php
          add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
          function enqueue_my_styles() {
      
              global $wp_styles;
      
              // Load the main stylesheet
              wp_enqueue_style( 'my-theme', get_stylesheet_uri() );
      
              /**
               * Load our IE-only stylesheet for all versions of IE:
               * <!--[if IE]> ... <![endif]-->
               * 
               * NOTE: It is also possible to just check and see if the $is_IE global in WordPress is set to true before 
               * calling the wp_enqueue_style() function.  If you are trying to load a stylesheet for all browsers 
               * EXCEPT for IE, then you would HAVE to check the $is_IE global since WordPress doesn't have a way to 
               * properly handle non-IE conditional comments.
               */
              wp_enqueue_style( 'my-theme-ie', get_stylesheet_directory_uri() . "/css/ie.css", array( 'my-theme' )  );
              $wp_styles->add_data( 'my-theme-ie', 'conditional', 'IE' );
          }
          ```
      
 82.  Found here (more code samples for version-specific IE stylesheets): [https://gist.github.com/wpscholar/4947518#file-functions-php](https://gist.github.com/wpscholar/4947518#file-functions-php)
 83.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D1453%23feedback-editor-1453)
 84.   [Skip to note 30 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-5781)
 85.    [Khoi Pro](https://profiles.wordpress.org/khoipro/)  [  4 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-5781)
 86.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-5781)
      Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-5781)
 87.  If you wish to load small screen css only, using last parameter:
 88.      ```php
          wp_enqueue_style( 'example-small-css', get_template_directory_uri() . '/assets/css/small.min.css', array(), '1.0.0', '(max-width: 480px)' );
          ```
      
 89.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D5781%23feedback-editor-5781)
 90.   [Skip to note 31 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-5894)
 91.    [Peter Hardy-vanDoorn](https://profiles.wordpress.org/petervandoorn/)  [  4 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-5894)
 92.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-5894)
      Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-5894)
 93.  When enqueueing your theme stylesheet, use `wp_get_theme()->get( 'Version' )`
      to get the latest version number from your style.css file. Great for cache busting
      when you make changes to your styles.
 94.  eg:
 95.      ```php
          wp_enqueue_style( 'my=theme', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ), 'all' );
          ```
      
 96.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D5894%23feedback-editor-5894)
 97.   [Skip to note 32 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-6386)
 98.    [Md Yousuf](https://profiles.wordpress.org/yousufislam/)  [  4 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-6386)
 99.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-6386)
      Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-6386)
 100. **If you use this code it automatic clear your cache, it will change the automatic
      version in the steel sheet**
 101.     ```php
          //if you want to see on your screen
          print_r( filemtime( get_template_directory() . '/style.css' ) );
          wp_die();
          ```
      
 102.     ```php
          function wpdocs_scripts() {
              wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), filemtime( get_template_directory() . '/style.css' ) );
          }
      
          add_action( 'wp_enqueue_scripts', 'wpdocs_scripts' );
          ```
      
 103.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D6386%23feedback-editor-6386)
 104.  [Skip to note 33 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-6634)
 105.   [KJ Roelke](https://profiles.wordpress.org/kjroelke/)  [  3 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-6634)
 106. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-6634)
      Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-6634)
 107. To make use of `file.asset.php` generated by `@wordpress/scripts` build command,
      you can use the following:
 108.     ```php
          // assuming you're using a modified 3rd-party CSS framework like bootstrap, call bootstrap's built dependencies file
          $bootstrap = require_once get_template_directory_uri() . '/build/bootstrap.asset.php';
      
          // Call your global CSS file (perhaps you're also writing CSS per page that you'll enqueue later)
          $global_dependencies = require_once get_template_directory_uri() . '/build/global.asset.php';
      
          // Load "bootstrap" css with
          wp_enqueue_style(
          	'bootstrap',
          	get_template_directory_uri() . '/build/bootstrap.css',
          	array(),
          	$bootstrap['version']
          );
      
          // Load your global css after 'bootstrap' css with the dependencies array (since that doesn't get popualted by build script)
          wp_enqueue_style(
          	'global',
          	get_template_directory_uri() . '/build/global.css',
          	array( 'bootstrap' ),
          	$global['version']
          );
          ```
      
 109.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D6634%23feedback-editor-6634)
 110.  [Skip to note 34 content](https://developer.wordpress.org/reference/functions/wp_enqueue_style/?output_format=md#comment-content-6958)
 111.   [Joynal Abedin](https://profiles.wordpress.org/joynalabedin/)  [  3 years ago  ](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-6958)
 112. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-6958)
      Vote results for this note: -1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%23comment-6958)
 113. TO avoid caching issue in version parameter put it time() function.
 114.     ```php
          wp_enqueue_style( 'handle-name', get_template_directory_uri() . 'path/css.css', array(), time(), 'all' );
          ```
      
 115.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F%3Freplytocom%3D6958%23feedback-editor-6958)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_enqueue_style%2F)
before being able to contribute a note or feedback.