Javascript loaded in all wordpress pages
-
Please: don’t enqueue all the scripts in all the pages this makes the website very slow!
Call the functions only when needed.for the moment i remove them from functions.php
if(!is_page(xxx) ) {
wp_dequeue_script( ‘gwolle_gb_frontend_js’ );
wp_deregister_script( ‘gwolle_gb_frontend_js’ );wp_dequeue_script( ‘gwolle_gb_addon_frontend_js’ );
wp_deregister_script( ‘gwolle_gb_addon_frontend_js’ );}
but not making it to remove the inpage javascript added with
add_action( ‘wp_footer’, ‘gwolle_gb_preview_javascript’ );
function gwolle_gb_preview_javascript() {and other functions.
add_action( ‘wp_footer’, ‘remove_my_action’, 20 );
function remove_my_action(){
if(!is_page(xxx) ) {
remove_action(‘wp_footer’, ‘gwolle_gb_preview_javascript’, 20);
}
}
seems not working.
Any suggestions?
- The topic ‘Javascript loaded in all wordpress pages’ is closed to new replies.