Title: Recent Search Terms
Last modified: June 22, 2019

---

# Recent Search Terms

 *  Resolved [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/)
 * Hi Jason,
 * I’ve been looking over the ‘Recent Search Terms’ (both widget and shortcode) 
   and have decided to settle with the shortcode version as it’s easier to place
   on a page.
 * However, a couple of questions:
 * Is it possible to limit the amount of search terms to the ten or so latest ones?
 * Also:
 * Can the search terms have links added to them somehow so that nosey users (me
   included ?!?) can see at a glance what’s being searched for and the result of
   that search?
 * Thanks for any help and info!
    -  This topic was modified 6 years, 10 months ago by [steveraven](https://wordpress.org/support/users/steveraven/).

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11663496)
 * Hi [@steveraven](https://wordpress.org/support/users/steveraven/)
 * if you look at our knowledge base, you’ll find what you’re looking for (and more):
 * [https://slimstat.freshdesk.com/support/solutions/articles/5000631833-what-is-the-syntax-of-a-slimstat-shortcode-](https://slimstat.freshdesk.com/support/solutions/articles/5000631833-what-is-the-syntax-of-a-slimstat-shortcode-)
 * Specifically:
 * – **limit_results** allows you to determine how many records to display
    – **
   post_link** can be used to display linked titles instead of permalinks
 * So for example, in your case, the shortcode would be something like:
 * `[slimstat f="recent" w="post_link"]limit_results equals 10[/slimstat]`
 * I hope this helps,
    Jason
 *  Thread Starter [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11665572)
 * Excellent stuff, thanks Jason!
 * I’d originally declined to use the above syntax as it didn’t appear to work –
   it shows ‘Pages and Posts’ rather than the ‘search terms’ used to find them.
 * So I’ll still keep the original, but your shortcode will be added too!
 *  Thread Starter [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11665780)
 * Hi Jason,
 * The above syntax doesn’t work after all.
 * It just shows the last few pages and posts viewed by visitors, and if I happen
   to clear the cache, it resets to being empty until it’s re-populated.
 * I remember now going into the syntax examples page and trying to find a likely
   candidate, but I couldn’t get anything to work that had the users actual search
   term, and a link back to the page/post that was subsequently found.
    -  This reply was modified 6 years, 10 months ago by [steveraven](https://wordpress.org/support/users/steveraven/).
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11666290)
 * My bad, I misread your original request. Replace post_link with searchterms:
 * `[slimstat f="recent" w="searchterms"]limit_results equals 10[/slimstat]`
 * Unfortunately Slimstat doesn’t currently support linking to search engine results
   pages connected to those keywords. The closest you could do is:
 * `[slimstat f="recent" w="referer"]searchterms is_not_empty #&&&limit_results 
   equals 10[/slimstat]`
 * Jason
    -  This reply was modified 6 years, 10 months ago by [Jason Crouse](https://wordpress.org/support/users/coolmann/).
 *  Thread Starter [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11666913)
 * Yes, I’m already using the first example (minus the limit_results bit as that
   doesn’t seem to work) on my website.
 * Tried the second example and it just comes out with a load of gobbldegook if 
   you get something like Yandex being the referrer.
 * Ah well, just a thought – thanks Jason.
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667078)
 * Hi [@steveraven](https://wordpress.org/support/users/steveraven/)
 * strange that limit_results doesn’t work for you. Enabling Debug Mode in the settings
   should show you the SQL query that was used, and you should see the “LIMIT” clause
   in it.
 * Yes, the second one is definitely not what you’re looking for. I will add your
   request to our wishlist for future consideration! Or you could write your own
   shortcode with a little help from a PHP developer 😉
 * Best,
    Jason
 *  Thread Starter [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667140)
 * okey dokey – just make sure that anyone searching for a ‘red car’ in the search
   results with ‘bloody great big red car’ gets it linked to the ‘red car’ page,
   with his search term, so we can all have a laugh!
 *  Thread Starter [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667192)
 * Hang on – think I’m on to something here.
 * Just tried adding:
 * [slimstat f=’recent’ w=’searchterms,post_link’][/slimstat]
 * …and all of a sudden, loads of links, pages/posts, and more importantly pages/
   posts with LINKED SEARCH TERMS appeared!
 * I’ll have a closer look when I get home!
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667479)
 * [@steveraven](https://wordpress.org/support/users/steveraven/) ha! How come I
   didn’t think about that. You’re absolutely right, that’s brilliant! 🙂
 *  Thread Starter [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667724)
 * Yes, all I need to do now is limit the search terms.
 * That SQL query thing doesn’t seem to be working either – where does the query
   show up?
 *  Thread Starter [steveraven](https://wordpress.org/support/users/steveraven/)
 * (@steveraven)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667853)
 * Got it – finally got the search terms limit working and it was a schoolboy error–
   I forgot that shortcodes should be added in the text editor, rather than the 
   visual one.
 * All up and running now, thanks Jason – methinks that white bar is calling!
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667876)
 * My bad, you’re right. The SQL debug code doesn’t show up on shortcodes for security
   purposes.
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667882)
 * > Got it – finally got the search terms limit working and it was a schoolboy 
   > error – I forgot that shortcodes should be added in the text editor, rather
   > than the visual one.
 * Terrific! Nicely done, sir. Time to celebrate at that white bar! Haha.
 * Take care,
    Jason

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Recent Search Terms’ is closed to new replies.

 * ![](https://ps.w.org/wp-slimstat/assets/icon.svg?rev=2832242)
 * [SlimStat Analytics](https://wordpress.org/plugins/wp-slimstat/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-slimstat/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-slimstat/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-slimstat/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-slimstat/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-slimstat/reviews/)

 * 13 replies
 * 2 participants
 * Last reply from: [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/recent-search-terms/#post-11667882)
 * Status: resolved