I’m learning to developing in Php and WordPress. Somebody can explain to me what mean a handle in this context:
<?php wp_enqueue_style( $handle, $src, $deps, $ver, $media ); ?>
Parameters
$handle
(string) (required) Name used as a handle for the stylesheet. As a special case, if the string contains a ‘?’ character, the preceding part of the string refers to the registered handle, and the succeeding part is appended to the URL as a query string.
Default: None
url: https://codex.wordpress.org/Function_Reference/wp_enqueue_style
Thanks!! 🙂
In general, a handle is just an identifier. In this case, the handle is just a unique name for the script you are enqueuing.
If you were using
wp_register_style
, you could use the handle to enqueue the registered style:You can also dequeue styles using the handle as a way to reference the desired style.
The documentation you referenced pertains to a special case when using
wp_enqueue_script
. In this instance you can use the handle parameter to also specify a query string for your script:In the above example, the handle is
style-handle
. The portion after the?
will be added the the enqueued script as a query string.