diff --git a/src/wp-includes/class.wp-scripts.php b/src/wp-includes/class.wp-scripts.php
index 4d7bd9e1b2..acd3d69c78 100644
|
a
|
b
|
class WP_Scripts extends WP_Dependencies { |
| 418 | 418 | * @param string $data String containing the JavaScript to be added. |
| 419 | 419 | * @param string $position Optional. Whether to add the inline script |
| 420 | 420 | * before the handle or after. Default 'after'. |
| | 421 | * @param string $type Optional. Value of the type html attribute. Default empty. |
| 421 | 422 | * @return bool True on success, false on failure. |
| 422 | 423 | */ |
| 423 | | public function add_inline_script( $handle, $data, $position = 'after' ) { |
| | 424 | public function add_inline_script( $handle, $data, $position = 'after', $type = '' ) { |
| 424 | 425 | if ( ! $data ) { |
| 425 | 426 | return false; |
| 426 | 427 | } |
| … |
… |
class WP_Scripts extends WP_Dependencies { |
| 429 | 430 | $position = 'before'; |
| 430 | 431 | } |
| 431 | 432 | |
| | 433 | if ( ! empty ( $type ) ) { |
| | 434 | $this->type_attr = " type='" . $type . "'"; |
| | 435 | } |
| | 436 | |
| 432 | 437 | $script = (array) $this->get_data( $handle, $position ); |
| 433 | 438 | $script[] = $data; |
| 434 | 439 | |
diff --git a/src/wp-includes/functions.wp-scripts.php b/src/wp-includes/functions.wp-scripts.php
index abe87a10bb..2cbe4fd20b 100644
|
a
|
b
|
function wp_print_scripts( $handles = false ) { |
| 125 | 125 | * @param string $data String containing the JavaScript to be added. |
| 126 | 126 | * @param string $position Optional. Whether to add the inline script before the handle |
| 127 | 127 | * or after. Default 'after'. |
| | 128 | * @param string $type Optional. Value of the type html attribute. Default empty. |
| 128 | 129 | * @return bool True on success, false on failure. |
| 129 | 130 | */ |
| 130 | | function wp_add_inline_script( $handle, $data, $position = 'after' ) { |
| | 131 | function wp_add_inline_script( $handle, $data, $position = 'after', $type = '') { |
| 131 | 132 | _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); |
| 132 | 133 | |
| 133 | 134 | if ( false !== stripos( $data, '</script>' ) ) { |
| … |
… |
function wp_add_inline_script( $handle, $data, $position = 'after' ) { |
| 144 | 145 | $data = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) ); |
| 145 | 146 | } |
| 146 | 147 | |
| 147 | | return wp_scripts()->add_inline_script( $handle, $data, $position ); |
| | 148 | return wp_scripts()->add_inline_script( $handle, $data, $position, $type ); |
| 148 | 149 | } |
| 149 | 150 | |
| 150 | 151 | /** |