Answer the question
In order to leave comments, you need to log in
How to exclude a function from executing on AMP pages in Wordpress?
How to exclude a function from executing on AMP pages in Wordpress?
if (!(is_admin() && is_amp_endpoint())) {
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
return "$url defer=\"defer\"";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question