script_concat_settings()
- Since
- 2.8.0
- Source
wp-includes/script-loader.php:2471
Compatibility
- WordPress
- since 2.8.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Performance profile
How much work a call to script_concat_settings() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Moderate
- Scaling
- Constant
- Instructions
- 20–59
- Plugin surface
- None
- Called by
- 6
Reads stored settings via get_site_option(), cached per request but not free on a cold cache.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 66.
Nothing here hands control to plugin code.
6 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- optionnetwork option
get_site_option()called directly
Further down the call graph this can also reach hook, cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 12 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost script_concat_settings() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
ini_get() && $value && isset($concatenate_scripts) | 20–38 | ini_get(), wp_installing() |
ini_get() && !$value && isset($concatenate_scripts) | 24–42 | ini_get(), wp_installing(), get_site_option() |
!ini_get() && $value && isset($concatenate_scripts) | 24–42 | ini_get(), ini_get(), wp_installing() |
!ini_get() && !$value && isset($concatenate_scripts) | 28–46 | ini_get(), ini_get(), wp_installing(), get_site_option() |
ini_get() && $value && !isset($concatenate_scripts) && is_admin() | 29–51 | ini_get(), wp_installing(), is_admin() |
ini_get() && $value && !isset($concatenate_scripts) && !is_admin() | 32–55 | ini_get(), wp_installing(), is_admin(), did_action() |
ini_get() && !$value && !isset($concatenate_scripts) && is_admin() | 33–55 | ini_get(), wp_installing(), get_site_option(), is_admin() |
!ini_get() && $value && !isset($concatenate_scripts) && is_admin() | 33–55 | ini_get(), ini_get(), wp_installing(), is_admin() |
ini_get() && !$value && !isset($concatenate_scripts) && !is_admin() | 36–59 | ini_get(), wp_installing(), get_site_option(), is_admin(), did_action() |
!ini_get() && $value && !isset($concatenate_scripts) && !is_admin() | 36–59 | ini_get(), ini_get(), wp_installing(), is_admin(), did_action() |
!ini_get() && !$value && !isset($concatenate_scripts) && !defined('CONCATENATE_SCRIPTS') && is_admin() | 37–58 | ini_get(), ini_get(), wp_installing(), get_site_option(), is_admin() |
!ini_get() && !$value && !isset($concatenate_scripts) && !defined('CONCATENATE_SCRIPTS') && !is_admin() && !did_action() | 40–56 | ini_get(), ini_get(), wp_installing(), get_site_option(), is_admin(), did_action() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 66 | 20–59 | 18 | |
| 8.5 | 66 | 20–59 | 18 | |
| 8.4 | 66 | 20–59 | 18 | |
| 8.3 | 66 | 20–59 | 18 | |
| 8.2 | 66 | 20–59 | 18 | |
| 8.1 | 66 | 20–59 | 18 | 3 fewer instructions than PHP 7.4 |
| 7.4 | 69 | 20–62 | 18 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 4
- wp_installing()Checks or sets whether WordPress is in "installation" mode.
- get_site_option()Retrieve an option value for the current network based on name of option.
- is_admin()Determines whether the current request is for an administrative interface page.
- did_action()Retrieves the number of times an action has been fired during the current request.
Used by · 6
- _WP_Editors::print_tinymce_scripts()Print (output) the main TinyMCE scripts.
- print_admin_styles()Prints the styles queue in the HTML head on admin pages.
- print_footer_scripts()Prints the scripts that were queued for the footer or too late for the HTML head.
- print_head_scripts()Prints the script queue in the HTML head on admin pages.
- print_late_styles()Prints the styles that were queued too late for the HTML head.
- wp_register_tinymce_scripts()Registers TinyMCE scripts.
Source code
function script_concat_settings() { global $concatenate_scripts, $compress_scripts, $compress_css; $compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ); $can_compress_scripts = ! wp_installing() && get_site_option( 'can_compress_scripts' ); if ( ! isset( $concatenate_scripts ) ) { $concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true; if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) { $concatenate_scripts = false; } } if ( ! isset( $compress_scripts ) ) { $compress_scripts = defined( 'COMPRESS_SCRIPTS' ) ? COMPRESS_SCRIPTS : true; if ( $compress_scripts && ( ! $can_compress_scripts || $compressed_output ) ) { $compress_scripts = false; } } if ( ! isset( $compress_css ) ) { $compress_css = defined( 'COMPRESS_CSS' ) ? COMPRESS_CSS : true; if ( $compress_css && ( ! $can_compress_scripts || $compressed_output ) ) { $compress_css = false; } }}Changelog
Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/script-loader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.