wp_get_view_transitions_admin_css(): string

Gets the CSS for View Transitions in the admin.

Return

string The CSS.

Source

function wp_get_view_transitions_admin_css(): string {
	$affix = SCRIPT_DEBUG ? '' : '.min';
	$path  = ABSPATH . "wp-admin/css/view-transitions{$affix}.css";
	return file_get_contents( $path );
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    This function reads the raw CSS file content and returns it as a string, rather than returning a URL. This is because the view-transitions CSS ends up being registered as inline CSS (added directly inside a tag in wp-admin), not as a separate stylesheet file loaded via .

    You can see this in practice: wp_default_styles() calls this function and passes the returned string to $styles->add_data(), using the ‘after’ key, so the CSS is printed inline right after the ‘wp-view-transitions-admin’ handle is enqueued.

    Also note that the CSS file used depends on SCRIPT_DEBUG: if it’s true, the unminified ‘view-transitions.css’ is read; otherwise, the minified ‘view-transitions.min.css’ is used, following the same convention as other core styles/scripts.

You must log in before being able to contribute a note or feedback.