apply_filters( ‘style_loader_src’, string $src, string $handle )

Filters an enqueued style’s fully-qualified URL.


The source URL of the enqueued style.
The style’s registered handle.


$src = apply_filters( 'style_loader_src', $src, $handle );



User Contributed Notes

  1. Skip to note 4 content

    If you have a child theme that has had its stylesheet enqueued from within the main Parent theme, and you wish to update the version number that’s appended to the url, you can include this in your child theme functions.php file.

    Obviously, change the version number (‘6.0.0’ in this example) to whatever is appropriate for you, along with comparing the approriate stylesheet handle (‘wpdocs-style’ in this example)

    $src – (string) The source URL of the enqueued style
    $handle – (string) The style’s registered handle

     * Update the version number on our child theme stylesheet, that's been enqueued from within the parent theme
    function wpdocs_update_stylesheet_version( $src, $handle ) {
    	if ( ! strcmp( $handle, 'wpdocs-style' ) ) {
    		$src = get_stylesheet_uri();
    		$src = add_query_arg( 'ver', '6.0.0', $src );
    	return $src;
    add_filter( 'style_loader_src', 'wpdocs_update_stylesheet_version', 10, 2 );

You must log in before being able to contribute a note or feedback.