Join

Prevent All Map Service Assets From Loading

Don't want to mess with code snippets? This is a feature of MyListing Pro.

Instructions

  1. Create a new PHP code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

This code snippet will help speed up MyListing websites that don’t need map services.

PHP
add_action( 'wp_enqueue_scripts', function() {
    wp_dequeue_script( 'google-maps' );
    wp_dequeue_script( 'mylisting-maps' );
    wp_dequeue_style( 'mylisting-maps' );
}, 1000 );