[wp-trac] [WordPress Trac] #48760: Adjust argument type for wp_dequeue_style/wp_dequeue_script
WordPress Trac
noreply at wordpress.org
Fri Nov 22 03:01:32 UTC 2019
#48760: Adjust argument type for wp_dequeue_style/wp_dequeue_script
-------------------------+-----------------------------
Reporter: vanyukov | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Currently, both functions require a string argument
{{{@param string $handle Name of the stylesheet to be removed.}}}
and will show a warning in IDE when an array is used: {{{Expected string,
got array}}}
While the associated {{{dequeue()}}} methods for WP_Styles and WP_Scripts
accept a mixed type argument.
{{{* @param mixed $handles Item handle and argument (string) or item
handles and arguments (array of strings).}}}
and will actually cast the string to an array:
{{{#!php
public function dequeue( $handles ) {
foreach ( (array) $handles as $handle ) {
$handle = explode( '?', $handle );
$key = array_search( $handle[0], $this->queue );
if ( false !== $key ) {
unset( $this->queue[ $key ] );
unset( $this->args[ $handle[0] ] );
}
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48760>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list