Skip to content

use global $wp_query->found_posts instead of creating a new WP_Query to count search results in trackSiteSearch mode, for better performance#111

Merged
braekling merged 1 commit intomatomo-org:masterfrom
theodejager:feature/faster-tracksitesearch
May 21, 2023
Merged

use global $wp_query->found_posts instead of creating a new WP_Query to count search results in trackSiteSearch mode, for better performance#111
braekling merged 1 commit intomatomo-org:masterfrom
theodejager:feature/faster-tracksitesearch

Conversation

@theodejager
Copy link
Copy Markdown

When "Track search: Use Matomo's advanced Site Search Analytics feature" is selected, an extra/new WP_Query is ran to count the number of results and push them to Matomo. This can really slow down searches.

Using the already available global $wp_query object avoids having to run an extra query.

… to count search results in trackSiteSearch mode, for better performance
@braekling braekling merged commit 7b53aba into matomo-org:master May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants