wp_deregister_style()WP 2.1.0

Remove a registered stylesheet.

1 time — -0.00003 sec (speed of light) | 50000 times — 0.02 sec (speed of light) | PHP 7.4.8, WP 5.8.1

No Hooks.

Return

null. Nothing.

Usage

wp_deregister_style( $handle );
$handle(string) (required)
Name of the stylesheet to be removed.

Examples

0

#1 Unregister the styles file

Suppose style with ID my_style was registered on init hook and we need to delete that style registration:

add_action( 'init', 'remove_my_style_stylesheet', 99 );

function remove_my_style_stylesheet() {

	wp_deregister_style( 'my_style' );
}

Notes

Changelog

Since 2.1.0 Introduced.

Code of wp_deregister_style() WP 6.0

function wp_deregister_style( $handle ) {
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

	wp_styles()->remove( $handle );
}