Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Last active Nov 18, 2020
Embed
What would you like to do?
<?php
$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