• Resolved Vil

    (@viljevitch)


    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?

Viewing 1 replies (of 1 total)
  • Thread Starter Vil

    (@viljevitch)

    made it!

    add_action( 'init', 'remove_my_action', 20 );
    function remove_my_action(){
        if(!is_page(xxx) ) {
      
            remove_action('wp_footer', 'gwolle_gb_preview_javascript');
            remove_action('wp_footer', 'gwolle_gb_delete_javascript');
            remove_action('wp_footer', 'gwolle_gb_admin_reply_javascript');
            remove_action('wp_footer', 'gwolle_gb_report_abuse_javascript');
            
        }
    }
    • This reply was modified 4 years, 5 months ago by Vil.
Viewing 1 replies (of 1 total)
  • The topic ‘Javascript loaded in all wordpress pages’ is closed to new replies.