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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

theodejager
Copy link

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 braekling: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