Hi filisara,
Please try following PHP snippet for GDv2.
/**
* 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() ) {
global $geodir_location_manager;
// GeoDirectory
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 );
// Location Manager
if ( ! empty( $geodir_location_manager ) ) {
remove_action( 'wp_enqueue_scripts', array( $geodir_location_manager, 'add_styles' ), 10 );
remove_action( 'wp_enqueue_scripts', array( $geodir_location_manager, 'add_scripts' ), 10 );
}
}
}
add_action( 'wp', 'gd_snippet_dequeue_scripts', 100 );
Regards,
Kiran