| 开发者 | cornel.raiu |
|---|---|
| 更新时间 | 2026年9月28日 17:45 |
| PHP版本: | 5.6 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv3 or later |
| 版权网址: | 版权信息 |
wpv_post_search, including REST API requests that use them.mwtsa_process_search_term( $term, $result_count ). It runs the same exclusion checks as a normal search and returns whether the search was saved.
Filters: mwtsa_do_not_save_search, mwtsa_exclude_term, mwtsa_extra_exclude_conditions, mwtsa_result_count, mwtsa_export_filename, plus filters on the shortcode output. Actions: mwtsa_after_term_save, mwtsa_after_history_term_save. The code is on GitHub.
Support
Questions and ideas are welcome in the support forum. If the plugin is useful to you, a review helps other site owners find it.
Yes. WooCommerce's product search box opens the normal search results page, so each product search is recorded with the number of products it found, just like a blog search. A live search that only shows results in a dropdown needs a line of code (see "Why aren't some searches being recorded?" below).
On the Search Analytics page, click "Only Without Results" and pick a time range. Then sort by "No. of Searches" to put the most common dead ends first.
Yes. In the settings, choose the roles to ignore under "Ignore search queries for these user roles", for example Administrator and Editor. To keep ignoring those users after they log out, also tick "Ignore search queries for the above user roles even after the user has logged out". This sets a cookie in their browser when they log in. You can list IP addresses to ignore too, like your office's.
The plugin records searches that load your site's search results page (the ?s= address). If one is missing, check these:
s, add it under "Add custom search parameters for recording the searches".if ( function_exists( 'mwtsa_process_search_term' ) ) { mwtsa_process_search_term( $term, $result_count ); }
mwtsa_process_search_term() applies the same settings as a normal search. For anything else, ask on the Support Forum.
Only searches do any work. Each search is saved with a few small database queries. Other pages only check whether they are a search, and the plugin loads no scripts or styles on the front end. With "Save Search Country" on, the first search from a new IP address waits for the country lookup, which gives up after 2 seconds. The result is then cached for a day. The history table grows with every search and nothing is deleted automatically. To trim it, use "Delete data older than" in the Erase History section of the settings.
Here is everything it keeps and shares, so you can check it against the GDPR or your local rules:
Yes. The "Export Data" button on the statistics page downloads what you're looking at as a CSV file, with the same time range, filters and grouping.
Yes, with two shortcodes:
[mwtsa_display_search_stats] lists the most searched terms, plus the visitor's own recent searches if they're logged in and "Save Search By User" is on.[mwtsa_display_latest_searches] lists the most recent search terms.[mwtsa_display_latest_searches unit="month" count="5"] shows the five most recent terms from the past month.
In a widget area, use the Shortcode block, or the Text widget on WordPress 4.9 and later. On 4.7 and 4.8, add add_filter( 'widget_text', 'do_shortcode' ); to your child theme's functions.php.
No. Deactivating the plugin always keeps the search history. To remove it, check "Delete all search data and settings when the plugin is deleted" on the plugin's settings page, then delete the plugin from the Plugins screen. On multisite, each site's data is only removed if that site has the setting checked.
You can use the Support Forum or open new issues on the GitHub repository: Search Analytics for WP.
Please report security bugs found in the source code of the Search Analytics for WP plugin through the Patchstack Vulnerability Disclosure Program. The Patchstack team will assist you with verification, CVE assignment, and notify me, the developer of Search Analytics for WP.
mwtsa_process_search_term() function records searches from your own code, such as an AJAX live search, with the same checks as a normal searchmwtsa_stats_table_* and mwtsa_term_stats_table_* filters are deprecated. Search Analytics 2.0 replaces the statistics screens and they will no longer run therewp-admin/index.php?page=search-analytics%2Fadmin%2Fincludes%2Fclass.stats.php to wp-admin/admin.php?page=mwtsa-search-analytics. A proper redirect was added to the old routewp-admin/options-general.php?page=search-analytics to wp-admin/admin.php?page=mwtsa-search-analytics-settings. A proper redirect was added to the old routemwtsa_run_terms_history_data_query_args filter for changing the args before history data gets queried$mwtsa. It will be removed in a later version. Use the MWTSAI() to get the instancemwt_ prefix and renamed them to the proper prefix mwtsa_ to prevent possible collisionsmwtsa_run_terms_history_data_query filter. It could be used by bad actors to modify the query and pass a not sanitized query throughmwt_wp_date_format_to_js_datepicker_format() helper functionwp_timezone() in WP < 5.3.0