wp_dequeue_script() – Function | Developer.WordPress.org

Removes a previously enqueued script.

Description

See also

Parameters

$handlestringrequired

Name of the script to be removed.

Source

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

	wp_scripts()->dequeue( $handle );
}

View all references View on Trac View on GitHub

UsesDescription
wp_scripts()wp-includes/functions.wp-scripts.php

Initializes $wp_scripts if it has not been set.

Used byDescription
WP_Block::render()wp-includes/class-wp-block.php

Generates the render output for the block.

Changelog

VersionDescription
3.1.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Dequeue a script

    /**
     * Dequeue the jQuery UI script.
     *
     * Hooked to the wp_print_scripts action, with a late priority (100),
     * so that it is after the script was enqueued.
     */
    function wpdocs_dequeue_script() {
    	wp_dequeue_script( 'jquery-ui-core' );
    }
    add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );