| @@ -118,9 +118,13 @@ | ||
| 118 | 118 | * @param String $handle handle. |
| 119 | 119 | */ |
| 120 | 120 | public function add_id_to_tracking_code( $tag, $handle ) { |
| 121 | 121 | if ( AssetsManager::TRACKING_CODE === $handle ) { |
| 122 | - $tag = str_replace( "id='" . $handle . "-js'", "async defer id='hs-script-loader'", $tag ); | |
| 122 | + $tag = preg_replace( | |
| 123 | + '/id=[\'"]' . preg_quote( $handle . '-js', '/' ) . '[\'"]/', | |
| 124 | + "async defer id='hs-script-loader'", | |
| 125 | + $tag | |
| 126 | + ); | |
| 123 | 127 | } |
| 124 | 128 | return $tag; |
| 125 | 129 | } |
| 126 | 130 | |
| @@ -130,9 +134,9 @@ | ||
| 130 | 134 | * @param String $tag tag name. |
| 131 | 135 | * @param String $handle handle. |
| 132 | 136 | */ |
| 133 | 137 | public function add_defer_to_forms_script( $tag, $handle ) { |
| 134 | - if ( AssetsManager::FORMS_SCRIPT === $handle ) { | |
| 138 | + if ( AssetsManager::FORMS_SCRIPT === $handle || AssetsManager::FORMS_V4_SCRIPT === $handle ) { | |
| 135 | 139 | $tag = str_replace( 'src', 'defer src', $tag ); |
| 136 | 140 | } |
| 137 | 141 | return $tag; |
| 138 | 142 | } |