wp-includes/functions.wp-scripts.php:92Adds the data for the recognized args and warns for unrecognized args.
$wp_scriptsWP_Scripts$handlestring$argsarrayfunction _wp_scripts_add_args_data( WP_Scripts $wp_scripts, string $handle, array $args ): void { $allowed_keys = array( 'strategy', 'in_footer', 'fetchpriority', 'module_dependencies' ); $unknown_keys = array_diff( array_keys( $args ), $allowed_keys ); if ( ! empty( $unknown_keys ) ) { $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 ); $function_name = ( $trace[1]['class'] ?? '' ) . ( $trace[1]['type'] ?? '' ) . ( $trace[1]['function'] ?? __FUNCTION__ ); _doing_it_wrong( $function_name, sprintf( /* translators: 1: $args, 2: List of unrecognized keys, 3: List of supported keys. */ __( 'Unrecognized key(s) in the %1$s param: %2$s. Supported keys: %3$s' ), '$args', implode( wp_get_list_item_separator(), $unknown_keys ), implode( wp_get_list_item_separator(), $allowed_keys ) ), '7.0.0' ); } $in_footer = ! empty( $args['in_footer'] ); if ( $in_footer ) { $wp_scripts->add_data( $handle, 'group', 1 ); } if ( ! empty( $args['strategy'] ) ) { $wp_scripts->add_data( $handle, 'strategy', $args['strategy'] ); } if ( ! empty( $args['fetchpriority'] ) ) { $wp_scripts->add_data( $handle, 'fetchpriority', $args['fetchpriority'] ); } if ( ! empty( $args['module_dependencies'] ) ) { $wp_scripts->add_data( $handle, 'module_dependencies', $args['module_dependencies'] ); /* * A classic script with module dependencies must either be printed in the * footer or use the 'defer' loading strategy. Otherwise, the script may be * evaluated before the script modules import map is printed, causing * dynamic imports to fail with a "Failed to resolve module specifier" error. */ $is_deferred = 'defer' === ( $args['strategy'] ?? null ); if ( ! $in_footer && ! $is_deferred ) { $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 ); $function_name = ( $trace[1]['class'] ?? '' ) . ( $trace[1]['type'] ?? '' ) . ( $trace[1]['function'] ?? __FUNCTION__ ); _doing_it_wrong( $function_name, sprintf( /* translators: 1: 'module_dependencies', 2: Script handle, 3: 'in_footer', 4: 'strategy', 5: 'defer'. */ __( 'When the %1$s arg is provided, the "%2$s" script must either be printed in the footer (%3$s set to true) or use a deferred loading %4$s (%5$s) so that the import map is printed before the script is evaluated.' ), '<code>module_dependencies</code>', $handle, '<code>in_footer</code>', '<code>strategy</code>', '<code>defer</code>' ), '7.0.0' ); } }}Introduced in 7.0.0. Unchanged from 7.0.4 through 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
src/wp-includes/functions.wp-scripts.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.