On this page
wp_scripts_get_suffix( string $type = '' ): string
Returns the suffix that can be used for the scripts.
Description
There are two suffix types, the normal one and the dev suffix.
Parameters
$typestring Optional-
The type of suffix to retrieve.
Default:
''
Return
string The script suffix.
Source
File: wp-includes/script-loader.php. View all references
function wp_scripts_get_suffix( $type = '' ) {
static $suffixes;
if ( null === $suffixes ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$develop_src = false !== strpos( $wp_version, '-src' );
if ( ! defined( 'SCRIPT_DEBUG' ) ) {
define( 'SCRIPT_DEBUG', $develop_src );
}
$suffix = SCRIPT_DEBUG ? '' : '.min';
$dev_suffix = $develop_src ? '' : '.min';
$suffixes = array(
'suffix' => $suffix,
'dev_suffix' => $dev_suffix,
);
}
if ( 'dev' === $type ) {
return $suffixes['dev_suffix'];
}
return $suffixes['suffix'];
}
Related
Used By
| Used By | Description |
|---|---|
| wp_enqueue_classic_theme_styles() wp-includes/script-loader.php | Loads classic theme styles on classic themes in the frontend. |
| wp_add_editor_classic_theme_styles() wp-includes/script-loader.php | Loads classic theme styles on classic themes in the editor. |
| wp_register_tinymce_scripts() wp-includes/script-loader.php | Registers TinyMCE scripts. |
| wp_default_packages_vendor() wp-includes/script-loader.php | Registers all the WordPress vendor scripts that are in the standardized |
| wp_default_packages_scripts() wp-includes/script-loader.php | Registers all the WordPress packages scripts that are in the standardized |
| print_embed_scripts() wp-includes/embed.php | Prints the JavaScript in the embed iframe header. |
| get_post_embed_html() wp-includes/embed.php | Retrieves the embed code for a specific post. |
| wp_default_scripts() wp-includes/script-loader.php | Registers all WordPress scripts. |
Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_scripts_get_suffix