• Hi,

    I’m wondering how to make a widget for showing the latest common queries, like we have in the admin dashboard.

    Php code examples welcome…

    Many thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Mikko Saari

    (@msaari)

    First of all, are you sure you want that? When you have a widget showing the queries, you’re essentially giving your website users a chance to post whatever they want on your site. Profanities, unpleasant political propaganda, criminal content that may land you in trouble… I don’t think it’s a very safe thing to have on your website.

    Relevanssi uses the relevanssi_total_queries() function (in lib/interface.php) to print out the list of common queries. It’s probably not directly usable, but you can see how to fetch the queries from that. There are plenty of good guides on how to create widgets available, so just take one of those, add the queries and remember caching, so you don’t have to fetch the data and build the widget on every page load.

Viewing 1 replies (of 1 total)
  • The topic ‘How to make a widget for displaying the latest common queries?’ is closed to new replies.