-
-
Save searchwpgists/1d8294f9b268c6b6ebd0a814e46d6030 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// @link https://searchwp.com/documentation/classes/searchwp-statistics/ | |
$statistics = \SearchWP\Statistics::get_popular_searches( [ | |
// 7 days old or newer. | |
'days' => 7, | |
// The Engine used for searches. | |
'engine' => 'default', | |
// The search queries to ignore i.e. spam, junk. | |
'exclude' => [ 'spam search query', 'lorem ipsum' ], | |
// How many search queries to return. | |
'limit' => 5, | |
// With at least one result. | |
'min_hits' => 1, | |
// With at most 100 results. | |
'max_hits' => 100, | |
// Which site(s) to consider. | |
'site' => [ get_current_blog_id() ], | |
] ); | |
// Display the stats in a <table>. | |
\SearchWP\Statistics::display( $statistics ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment