Possible to dequeue scripts?

This topic contains 7 replies, has 4 voices, and was last updated by  Naveen Giri 4 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #542332

    Berto
    Expired Member
    Post count: 53

    Is it possible to dequeue some Google Maps scripts?

    Not using maps whatsoever.

    https://gyazo.com/da57ae1520cf438e481fd71bdb833e37

    Thank you

    #542347

    Kor
    Moderator
    Post count: 16516

    Hi Berto,

    Thanks for your post. If you do not need any maps, you can disable it here https://wpgeodirectory.com/docs-v2/geodirectory/settings/general/#general

    #542352

    Berto
    Expired Member
    Post count: 53

    Hi,

    Thanks, that was already set and it does not dequeue anything I have highlighted.

    I take it there is no way to dequeue further as it’s deeply embedded into the core?

    #542362

    Alex Rollin
    Moderator
    Post count: 27815

    They are integrated, but we do provide instructions for de-queue so you can manage when they are queued

    https://wpgeodirectory.com/docs-v2/faq/performance/

    #542365

    Berto
    Expired Member
    Post count: 53

    I have already done that.

    Not to worry. Thanks anyway, Alex.

    Have a good evening.

    #542841

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Berto,

    Please try this code.

     
    /**
     * Dequeue core scripts & styles on non GD pages.
     *
     * Note: This may cause JavaScript errors when page contains widget/shortcode from GD.
     */
    function gd_snippet_dequeue_scripts() {
    	if ( class_exists( 'GeoDir_Frontend_Scripts' ) && ! geodir_is_geodir_page() && !is_front_page() ) {
    		remove_action('wp_footer', array( 'GeoDir_Frontend_Scripts', 'js_location_functions' ));
    		remove_action( 'wp_enqueue_scripts', array( 'GeoDir_Frontend_Scripts', 'load_scripts' ) );
    		remove_action( 'wp_print_scripts', array( 'GeoDir_Frontend_Scripts', 'localize_printed_scripts' ), 5 );
    		remove_action( 'wp_print_footer_scripts', array( 'GeoDir_Frontend_Scripts', 'localize_printed_scripts' ), 5 );
    	}
    }
    add_action( 'wp', 'gd_snippet_dequeue_scripts', 100 );
    

    Thanks

    #542856

    Berto
    Expired Member
    Post count: 53

    Thank you.

    #543040

    Naveen Giri
    Moderator
    Post count: 1559

    have a great day. 🙂

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount