Skip to content

Instantly share code, notes, and snippets.

@jchristopher

jchristopher/functions.php

Last active Apr 29, 2020
Embed
What would you like to do?
<?php
$statistics = \SearchWP\Statistics::get_popular_searches( [
// The number of days to go back.
'days' => 7,
// The Engine used for searches.
'engine' => 'default',
// The search queries to ignore i.e. spam, junk.
'exclude' => [ 'spam search query' ],
// How many search queries to return.
'limit' => 5,
// Minimum number of search results found.
'min_hits' => 1,
// Maximum number of search results found.
'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
You can’t perform that action at this time.