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.
// 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
-
wp_less_compiler
filterapply_filters( 'wp_less_compiler', 'wikimedia/less.php' ); -
wp-less_compiler_construct
filterapply_filters( 'wp-less_compiler_construct', $file ); -
do_action( 'wp-less_compiler_construct_pre', $this, $file ); -
apply_filters( 'wp-less_get_queued_styles_to_process', $to_process ); -
wp-less_init
actiondo_action( 'wp-less_init', $this ); -
wp-less_init_admin
actiondo_action( 'wp-less_init_admin', $this ); -
do_action( 'wp-less_plugin_process_stylesheets', $styles ); -
apply_filters( 'wp-less_stylesheet_compute_target_path', $target_path ); -
wp-less_stylesheet_construct
actiondo_action( 'wp-less_stylesheet_construct', $this ); -
wp-less_stylesheet_save
filterapply_filters( 'wp-less_stylesheet_save', $css, $stylesheet ); -
wp-less_stylesheet_save_post
actiondo_action( 'wp-less_stylesheet_save_post', $stylesheet ); -
wp-less_stylesheet_save_pre
actiondo_action( 'wp-less_stylesheet_save_pre', $stylesheet, $this->getVariables() ); -
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: