Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

defer parsing of javascript wordpress

// Only for Javascript

function defer_parsing_of_js( $url ) {
    if ( is_user_logged_in() ) return $url; //don't break WP Admin
    if ( FALSE === strpos( $url, '.js' ) ) return $url;
    if ( strpos( $url, 'jquery.js' ) ) return $url;
    return str_replace( ' src', ' defer src', $url );
}
add_filter( 'script_loader_tag', 'defer_parsing_of_js', 10 );
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue timeout 
Javascript :: como saber si un checkbox esta seleccionado en jquery 
Javascript :: return longest string from array 
Javascript :: error duplicate resources react native 
Javascript :: how to define emojis from your server in discord.js 
Javascript :: javascript how to change anchor style 
Javascript :: get first property from object javascript 
Javascript :: tailwind confirm 
Javascript :: option selected jquery 
Javascript :: url redirect javascript 
Javascript :: javascript redirect new window 
Javascript :: js display only date 
Javascript :: while loop countdown javascript 
Javascript :: js remove zeros after decimal 
Javascript :: json parse error: cannot deserialize value of type `java.time.localdate` from string 
Javascript :: console log state object redux 
Javascript :: datatable after loading function 
Javascript :: sequelize update record 
Javascript :: select random from an array 
Javascript :: getelementbyxpath 
Javascript :: jquery observe class change 
Javascript :: js select disabled 
Javascript :: component did mount in hooks 
Javascript :: react native open phone 
Javascript :: JavaScript Using a Temporary Variable 
Javascript :: angular 8 to 9 
Javascript :: last index array javascript 
Javascript :: remove text javascript 
Javascript :: javascript: get the url without query string 
Javascript :: how to set height of material ui dialog react 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =