WordPress at Your Fingertips
function is not described


AssetsController::register_style() protected WC 1.0

Registers a style according to wp_register_style.

{} It's a method of the class: AssetsController{}

No Hooks.


null. Nothing.


// protected - for code of main (parent) or child class
$result = $this->register_style( $handle, $src, $deps, $media, $rtl );
$handle(string) (required)
Name of the stylesheet. Should be unique.
$src(string) (required)
Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
An array of registered stylesheet handles this stylesheet depends on.
Default: empty array
The media for which this stylesheet has been defined. Accepts media types like 'all', 'print' and 'screen', or media queries like '(orientation: portrait)' and '(max-width: 640px)'.
Default: 'all'
Whether or not to register RTL styles.
Default: false

Code of AssetsController::register_style() WC 5.9.0

protected function register_style( $handle, $src, $deps = [], $media = 'all', $rtl = false ) {
	$filename = str_replace( plugins_url( '/', __DIR__ ), '', $src );
	$ver      = self::get_file_version( $filename );

	wp_register_style( $handle, $src, $deps, $ver, $media );

	if ( $rtl ) {
		wp_style_add_data( $handle, 'rtl', 'replace' );