Plugin Directory

Changeset 2726298


Ignore:
Timestamp:
05/18/2022 08:21:53 PM (4 years ago)
Author:
instantpage
Message:

Handle WordPress 5.3+ HTML5 script tags

File:
1 edited

Legend:

Unmodified
Added
Removed
  • instant-page/trunk/instantpage.php

    r2313031 r2726298  
    1818function instantpage_script_loader_tag( $tag, $handle ) {
    1919  if ( 'instantpage' === $handle ) {
    20     $tag = str_replace( 'text/javascript', 'module', $tag );
     20    if ( strpos( $tag, 'text/javascript' ) !== false ) {
     21      $tag = str_replace( 'text/javascript', 'module', $tag );
     22    }
     23    else {
     24      $tag = str_replace( '<script ', "<script type='module' ", $tag );
     25    }
    2126  }
    2227  return $tag;
Note: See TracChangeset for help on using the changeset viewer.