WP-LESS icon
Utilities

WP-LESS hooks reference

  • By thom4
  • v1.9.8
  • Updated

WP-LESS 1.9.8 has 7 actions and 6 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when WP-LESS fires an action
add_action( 'wp-less_compiler_construct_pre', function( $object, $file ) {
	// Your code runs here.
}, 10, 2 );

// Change a value WP-LESS is about to use
add_filter( 'wp_less_compiler', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • lib/Plugin.class.php line 73
    apply_filters( 'wp_less_compiler', 'wikimedia/less.php' );
  • lib/Compiler.class.php line 24
    apply_filters( 'wp-less_compiler_construct', $file );
  • lib/Compiler.class.php line 23
    do_action( 'wp-less_compiler_construct_pre', $this, $file );
  • lib/Plugin.class.php line 214
    apply_filters( 'wp-less_get_queued_styles_to_process', $to_process );
  • wp-less_init

    action
    lib/Plugin.class.php line 361
    do_action( 'wp-less_init', $this );
  • lib/Plugin.class.php line 361
    do_action( 'wp-less_init_admin', $this );
  • lib/Plugin.class.php line 288
    do_action( 'wp-less_plugin_process_stylesheets', $styles );
  • lib/Stylesheet.class.php line 71
    apply_filters( 'wp-less_stylesheet_compute_target_path', $target_path );
  • lib/Stylesheet.class.php line 53
    do_action( 'wp-less_stylesheet_construct', $this );
  • lib/Compiler.class.php line 110
    apply_filters( 'wp-less_stylesheet_save', $css, $stylesheet );
  • lib/Compiler.class.php line 114
    do_action( 'wp-less_stylesheet_save_post', $stylesheet );
  • lib/Compiler.class.php line 103
    do_action( 'wp-less_stylesheet_save_pre', $stylesheet, $this->getVariables() );
  • lib/Stylesheet.class.php line 123
    apply_filters( 'wp-less_stylesheet_source_content', file_get_contents($this->source_path) );

Generated from WP-LESS's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: