Skip Navigation

[Waiting for user confirmation] Speeding up displays with maps

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 8 replies, has 1 voice.

Last updated by Minesh 1 day, 17 hours ago.

Assisted by: Minesh.

Author
Posts
#2815064

Tell us what you are trying to do?

Get this page and others with maps to load faster: hidden link

That page has the most points - over 2500

Is there any documentation that you are following?

I couldn't find anything about optimizing map displays

Is there a similar example that we can see?

What is the link to your site?

hidden link

#2815080

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Displyaing 2500 markers on map is obviously will affect your page performance even without using Toolset. Maybe you want to paginate the results and based on paginated results you want to display the markers on the map.

#2815125

Cool. Great idea. One more question:

On the farms page (hidden link) I changed the view to not show the list of all the items showing on the map. What I'd really like to do is show a blank map at the start - is that possible? Then when someone uses the filters, it will show only a subset of the total items.

The map that shows all the pins at once is hard to use anyway.

#2815131

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - you can hide view result on page load:

You can add the following code to "Custom Code" section offered by Toolset:
- https://toolset.com/documentation/programmer-reference/adding-custom-code/

add_filter( 'wpv_filter_query', 'func_hide_toolset_view_on_page_load', 10, 3 );
function func_hide_toolset_view_on_page_load( $query_args, $view_settings, $view_id ) {

    // Replace with your specific View ID
    $target_view_id = 99999;

    // Only affect this specific view
    if ( $view_id == $target_view_id ) {

        // Check if it's an AJAX request or filter/search has been submitted
        $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
        $has_filter_input = !empty( $_GET ) || !empty( $_POST );

        if ( ! $is_ajax && ! $has_filter_input ) {
            // Prevent results on initial load
            $query_args['post__in'] = array( 0 );
        }
    }

    return $query_args;
}

Where:
- Replace 99999 with your original view ID.

More info:
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#2815483
Screenshot 2025-07-09 at 7.40.51 PM.png

That went a little bit further than I was expecting! See Image attached.

That also wiped out the filters down below as well as the pins on the map. It seems like the pins need to be "hidden" instead of not rendering the view - I still need that below.

Any compromise ideas?

Thanks!

#2815518

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok. Can you please share admin access details. Let me reivew how you configure your map and view and then I will be able to guide you in the right direction.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2815597

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now:
- hidden link

I've added the following code to "Custom Code" section offered by Toolset:
=> hidden link

function tssupp_no_initial_results( $query_results, $view_settings, $view_id ){
     
    $target_views = array( 2165); // Comma-separated list of View IDs
   
    if ( in_array( $view_id, $target_views ) ) {
     
        // if there is a search term set
        if ( !isset( $query_results->query['tax_query'] ) && !isset( $query_results->query['s'] ) ) {
            $query_results->posts = array();
            $query_results->post_count = 0;
            $query_results->found_posts = 0;
        }
    }
     
    return $query_results;
}
add_filter( 'wpv_filter_query_post_process', 'tssupp_no_initial_results', 10, 3 );

Also, I've removed the marker from your map block from the following page in backend:
- hidden link

And also added the view block that should displa ythe result. You can either add one view block that shows search form and result, that should also work.

#2815651

Almost! Very close. Is there any way that we can have the default mat come up centered on North Carolina USA - just with no data? So it doesn't look like the map is broken?

#2815989

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To set the map center to "North Carolina USA" I've grab the lat and long for the same address and you will find the option to set a default center With your Maps block.
=> Check this screenshot hidden link

What you need to do is, You will have to disable the setting "Adjust zoom and center to show all markers at once" option on the map, in order to get a default center. Once you input the default center value, you can reactivate the option, and the map center lat/long you configure will be in effect.

I've already done that for you. Can you please confirm it works as expected.