• shanebp

    (@shanebp)


    This issue is specific to the 2022 theme – it does not occur in any other theme. If I comment out the conditionals that use wp_script_is then it works with the WP 2022 theme.

    function pp_mm_enqueue_script() {
    
    	if ( ! wp_script_is( 'google-places-api', 'registered' ) ) {
    	
    		wp_register_script( 'google-places-api', '//maps.googleapis.com/maps/api/js?key=' . $gapikey . '&libraries=places' );
    
    		wp_register_script('google-maps-cluster', plugin_dir_url(__FILE__) . 'js/markerclusterer.min.js', array('jquery') );
    
    	}
    }
    add_action( 'wp_enqueue_scripts', 'pp_mm_enqueue_script' );
    
    // hook in map template
    function pp_mm_load_map_scripts() {
    
    	if ( wp_script_is( 'google-places-api', 'registered' ) ) {
    
    		wp_enqueue_script( 'google-places-api' );
    		wp_enqueue_script( 'google-maps-cluster' );
    
    		wp_print_scripts( 'google-places-api' );
    		wp_print_scripts( 'google-maps-cluster' );
    
    	}
    
    } 
    add_action( 'pp_map_scripts', 'pp_mm_load_map_scripts' );
  • The topic ‘conflict with wp_script_is’ is closed to new replies.