Make wp_register_style and wp_enqueue_style consistent
|Reported by:||koopersmith||Owned by:|
|Component:||Script Loader||Keywords:||has-patch needs-refresh|
When fixing #13056, I noticed that wp_register_style and wp_enqueue_style had a few odd differences.
- Enqueue truncates the $handle variable after the first '?' while register (and all other wp_style functions) accept any string.
- Register set the default for $media to 'all', while enqueue set it to false. (fixed in the #13056 patch).
Moreover, since the two functions are practically the same, I've grouped them together in a private _wp_register_style function with an additional $enqueue boolean. Both enqueue and register call _wp_register_style.
I've omitted the truncate behavior mentioned above. If there's any reason for it in one, and not the other, or in both, feel free to correct me.
We could also just remove the truncate behavior from enqueue. It's a minor patch, and comes down to coding style.