wp_enqueue_emoji_styles()wp-includes/formatting.php | Enqueues the important emoji-related styles.
|
wp_enqueue_embed_styles()wp-includes/embed.php | Enqueues the CSS in the embed iframe header.
|
wp_enqueue_block_template_skip_link()wp-includes/theme-templates.php | Enqueues the skip-link script & styles.
|
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()wp-includes/script-loader.php | Loads classic theme styles on classic themes in the frontend.
|
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()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()wp-includes/deprecated.php | Runs the theme.json webfonts handler.
|
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()wp-includes/script-loader.php | Enqueues a stylesheet for a specific block.
|
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()wp-includes/script-loader.php | Enqueues the global styles defined via theme.json.
|
WP_Block::render()wp-includes/class-wp-block.php | Generates the render output for the block.
|
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()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()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()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()wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the do_meta_boxes actions.
|
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()wp-includes/class-wp-editor.php | Enqueue all editor scripts.
|
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()wp-includes/widgets/class-wp-widget-media-audio.php | Enqueue preview scripts.
|
WP_Widget_Media_Video::enqueue_preview_scripts()wp-includes/widgets/class-wp-widget-media-video.php | Enqueue preview scripts.
|
enqueue_embed_scripts()wp-includes/embed.php | Enqueues embed iframe default CSS and JS.
|
WP_Customize_Nav_Menus::enqueue_scripts()wp-includes/class-wp-customize-nav-menus.php | Enqueues scripts and styles for Customizer pane.
|
login_header()wp-login.php | Outputs the login page header.
|
wp_dashboard_setup()wp-admin/includes/dashboard.php | Registers dashboard widgets.
|
WP_Internal_Pointers::enqueue_scripts()wp-admin/includes/class-wp-internal-pointers.php | Initializes the new feature pointers.
|
iframe_header()wp-admin/includes/template.php | Generic Iframe header for use with Thickbox.
|
wp_iframe()wp-admin/includes/media.php | Outputs the iframe to display the media upload page.
|
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()wp-admin/includes/class-custom-background.php | Sets up the enqueue for the CSS & JavaScript files.
|
WP_Customize_Manager::customize_preview_init()wp-includes/class-wp-customize-manager.php | Prints JavaScript settings.
|
wp_admin_css()wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file.
|
add_thickbox()wp-includes/general-template.php | Enqueues the default ThickBox js and css.
|
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()wp-includes/class-wp-admin-bar.php | Initializes the admin bar.
|
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()wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript.
|
_WP_Editors::enqueue_scripts()wp-includes/class-wp-editor.php | |
For proper versioning based on the file’s last modified time, you can use something similar to:
wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/style.css'), false);
When the style.css file is updated on the server, WP will append the appropriate timestamp.
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.
Using a Hook
Scripts and styles from a single action hook
Load stylesheet only on a plugin’s options page:
Override all stylesheets in queue
!important
‘. One thing to consider though is that a value lower thanPHP_INT_MAX
would most likely suffice, leaving a possiblity for other plugins to in turn override your CSS.Using this method you can enqueue a child theme’s style.css.
How to remove
ver
in URL?If you want to remove the
ver
parameter in URL (for example, to intentionally cache the file), you pass innull
instead of false to remove that. For example:By doing that, you will get:
Enqueues should not be protocol specific, remove https. I have update code as below
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”.
The fix is to set
null
on the$version
parameter, which prevents the URL from being parsed and the additional font families lost.Trac ticket: https://core.trac.wordpress.org/ticket/49742
$version
parameter other thannull
.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()
withget_stylesheet_uri()
.See Also:
wp_enqueue_script
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.
For more info see https://stackoverflow.com/questions/36805009/wordpress-css-and-js-version-numbers-not-working
Load an IE-specific stylesheet:
Found here (more code samples for version-specific IE stylesheets): https://gist.github.com/wpscholar/4947518#file-functions-php
If you wish to load small screen css only, using last parameter:
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.eg:
If you use this code it automatic clear your cache, it will change the automatic version in the steel sheet
To make use of
file.asset.php
generated by `@wordpress/scripts` build command, you can use the following:TO avoid caching issue in version parameter put it time() function.