Okay
  Public Ticket #3155439
Google Connection
Closed

Comments

  • Christian started the conversation

    Google-Maps script is loaded automatically via functions.php of the parent theme. Is there any way to delete the connection (maps.googleapis.com) to Google? When i block the script (for example with the Borlabs script blocker) the site shows a white page and no content any more. Because of privacy regulations in the EU we have a need to do that. Many thanks for your Support!
    Kind regards

    Christian

  •  241
    Elena replied

    Hi Christian,

    You should be able to prevent the GMaps script from loading this way:

    - Activate the child theme

    - Open the functions.php file of the child theme, and add this function:

    function hemma_dequeue_maps() {
    wp_dequeue_script( 'google-maps' );
    }
    add_action( 'wp_print_scripts', 'hemma_dequeue_maps' );

    - Save the file and upload to the server

    Best, Elena

  • Christian replied

    Hi Elena, thank you for you quick replay, but the code has no effect. I hope you can help me further.

    Kind regards

    Christian

  •  241
    Elena replied

    Please try with this:

    function hemma_dequeue_maps() {
    wp_dequeue_script( 'google-maps' );
    wp_deregister_script( 'google-maps' );
    }
    add_action( 'wp_print_scripts', 'hemma_dequeue_maps' );

  • Christian replied

    Hi, now i have a blank page but the connection was interrupted.

    Kind regards

    Christian

  •  241
    Elena replied

    Would you mind to provide access to your WP so I can have a look? If so, please make a PRIVATE ticket with credentials.

  •   Christian replied privately
  •  241
    Elena replied

    Let's use this in your child theme:

    function hemma_dequeue_maps() {
    wp_dequeue_script( 'google-maps' );
    wp_deregister_script( 'google-maps' );
    }
    add_action( 'wp_print_scripts', 'hemma_dequeue_maps' );

    function hemma_child_scripts() {
        wp_enqueue_style( 'hemma-child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( 'hemma-style' ),
            wp_get_theme()->get('Version')
        );
    wp_enqueue_script( 'hemma-plugins-js', get_stylesheet_directory_uri() . '/js/plugins.js', array('jquery'), false, true );
    wp_enqueue_script( 'hemma-js', get_stylesheet_directory_uri() . '/js/main.js', array('jquery'), false, true );
    }
     add_action( 'wp_enqueue_scripts', 'hemma_child_scripts' );

    Then, in your child theme you need to add the js folder that I've attached (unzip it first).

    Best,

    Elena


  • Christian replied

    Hi Elena, this works perfect!! Many thanks!


    Kind regards

    Christian

  •  241
    Elena replied

    Sounds great!