WordPress filter hook · part of WordPress core

style_loader_src

A WordPress core filter that 25 plugins also fire themselves, running on 599K+ sites between them.

“Filter the style source URL”

How to use style_loader_src

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'style_loader_src', function( $style, $name ) {
	// Change $style here.
	return $style;
}, 10, 2 );

Argument names come from LH Zero Spam's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

25 plugins that fire style_loader_src

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Page Optimize icon Page Optimize300,000+ installs apply_filters( 'style_loader_src', $obj->src, $obj->handle ) concat-css.php:127
  2. Jetpack Boost icon Jetpack Boost200,000+ installs apply_filters( 'style_loader_src', $obj->src, $obj->handle ) app/lib/minify/class-concatenate-css.php:78
  3. SecuPress with Simple SSL icon SecuPress with Simple SSL40,000+ installs apply_filters( 'style_loader_src', $style_url, 'secupress' ) free/classes/scanners/class-secupress-scan-discloses.php:189
  4. NotificationX icon NotificationX30,000+ installs apply_filters( 'style_loader_src', $src, $handle ) includes/FrontEnd/FrontEnd.php:562
  5. PWA icon PWA20,000+ installs apply_filters( 'style_loader_src', $url, $handle ) integrations/class-wp-service-worker-styles-integration.php:77
  6. Swift Performance Lite icon Swift Performance Lite6,000+ installs apply_filters( 'style_loader_src', home_url(), 'dummy-handle' ) modules/asset-manager/asset-manager.php:453
  7. Powered Cache icon Powered Cache3,000+ installs apply_filters( 'style_loader_src', $obj->src, $obj->handle ) includes/classes/Optimizer/CSS.php:79
  8. MinQueue icon MinQueue200+ installs apply_filters( 'style_loader_src', $src, $handle ) class.minqueue.php:355
  9. LH Zero Spam icon LH Zero Spam100+ installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:152
  10. LH Sortable Tables icon LH Sortable Tables90+ installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:142
  11. LH Web Application icon LH Web Application10+ installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:98
  12. LH Javascript Error log icon LH Javascript Error log10+ installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:142
  13. LH Fresh Content icon LH Fresh Content10+ installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:152
  14. LH Paragraph Ids icon LH Paragraph Ids10+ installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:152
  15. ShahCalc icon ShahCalc10+ installs apply_filters( 'style_loader_src', $src, 'shahcalc-calculator' ) includes/class-shahcalc-shortcode.php:55
  16. Dashboard for Woo icon Dashboard for Woo10+ installs apply_filters( 'style_loader_src', $src, $handle ) includes/class-webangonwd-ajax.php:155
  17. Synced Pattern Popups icon Synced Pattern Popups10+ installs apply_filters( 'style_loader_src', $src, $handle ) includes/class-sppopups-plugin.php:802
  18. AdFever for WordPress icon AdFever for WordPress10+ installs apply_filters( 'style_loader_src', $src, $handle ) lib/wp-compat/class.wp-styles.php:83
  19. LH Related Posts by Taxonomy icon LH Related Posts by TaxonomyFewer than 10 installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:152
  20. LH CSS Dates and Times icon LH CSS Dates and TimesFewer than 10 installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:152
  21. LH Signup icon LH SignupFewer than 10 installs apply_filters( 'style_loader_src', $style, $this->name ) includes/lh-register-file-class.php:152
  22. Rooster LMS icon Rooster LMSFewer than 10 installs apply_filters( 'style_loader_src', self::src( $styles, $src, $item->ver ), $handle ) includes/CourseBuilder/PortalEditor.php:271
  23. ZetaLine Cookie icon ZetaLine CookieFewer than 10 installs apply_filters( 'style_loader_src', $href, $handle ) includes/class-script-manager.php:476
  24. LH Localforage icon LH LocalforageFewer than 10 installs apply_filters( 'style_loader_src', add_query_arg('ver', $style->ver,$style->src), $this->name ) includes/lh-register-file-class.php:100
  25. SoloAutomation icon SoloAutomationFewer than 10 installs apply_filters( 'style_loader_src', $href, $handle ) includes/services/class-soloautomation-elementor-performance.php:119

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.