wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_should_concatenate_admin_scripts › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_should_concatenate_admin_scripts ( Keine Parameter )
Gibt zurück:
  • (bool) Whether scripts and styles are concatenated on admin screens and the login screen.
Definiert in:
Codex:

Determines whether scripts and styles are concatenated on admin screens and the login screen.

Concatenation is on unless the CONCATENATE_SCRIPTS constant turns it off, and SCRIPT_DEBUG turns it off regardless. Scripts and styles are never concatenated elsewhere. This is the default that script_concat_settings() gives the $concatenate_scripts global when the global has not already been set. It is also how wp_prefetch_admin_assets() predicts, from the login screen, what the admin screen the login leads to will do. This function and its filter are intended to be removed before 7.2-beta1. They exist only while concatenation is still an option, and once concatenation is retired, there is nothing left for them to decide. Do not rely on them; setting the $concatenate_scripts global remains the way to override concatenation on a request.


Quellcode

function wp_should_concatenate_admin_scripts(): bool {
	$concatenate = ( defined( 'CONCATENATE_SCRIPTS' ) ? (bool) CONCATENATE_SCRIPTS : true )
		&& ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG );

	/**
	 * Filters whether scripts and styles are concatenated on admin screens and the login screen.
	 *
	 * Setting the `$concatenate_scripts` global directly still takes precedence over this filter on
	 * the request where it is set.
	 *
	 * An admin screen settles the global the first time scripts are registered, when the
	 * {@see 'wp_default_scripts'} action registers TinyMCE. That can be as early as while plugins
	 * load, before the theme's functions.php, whereas the login screen reads this filter only when
	 * it prints, to predict what the admin will do. So add a callback when a plugin loads, rather
	 * than from a theme or on a later hook, or the admin may not see it while the login screen does.
	 *
	 * @since 7.2.0
	 *
	 * @param bool $concatenate Whether scripts and styles are concatenated. Default true, unless the
	 *                          `CONCATENATE_SCRIPTS` constant is false or `SCRIPT_DEBUG` is true.
	 */
	return (bool) apply_filters( 'wp_should_concatenate_admin_scripts', $concatenate );
}