Title: Accessing Relevanssi User Searches programatically
Last modified: February 20, 2019

---

# Accessing Relevanssi User Searches programatically

 *  Resolved [avalanchedigital](https://wordpress.org/support/users/avalanchedigital/)
 * (@avalanchedigital)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/accessing-relevanssi-user-searches-programatically/)
 * Hi there,
 * Thanks for an excellent plugin.
 * Is there a way to access Relevanssi User Searches (Common Queries specifically)
   without making a custom SQL Query?
 * Many thanks.

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

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/accessing-relevanssi-user-searches-programatically/#post-11229599)
 * `relevanssi_date_queries( $days, $title, $version )` generates the HTML code 
   for the display. `$days` is the number of days of results to show, `$title` is
   the element heading and `$version` is either `good` for hits or `bad` for misses.
 * This echoes out the results, so if you want to use it for something else, you
   need to capture it with an output buffer:
 *     ```
       ob_start();
       relevanssi_date_queries( 7, 'title', 'good' );
       $content = ob_get_contents();
       ob_end_clean();
       ```
   
 * Now you have the most common queries for the past 7 days in `$content`. It’s 
   a HTML table formatted for the User searches page, so you may need to clean it
   up a bit.
 *  Thread Starter [avalanchedigital](https://wordpress.org/support/users/avalanchedigital/)
 * (@avalanchedigital)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/accessing-relevanssi-user-searches-programatically/#post-11229923)
 * That is fantastic, thanks Mikko. Have a good day sir.

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

The topic ‘Accessing Relevanssi User Searches programatically’ is closed to new 
replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [avalanchedigital](https://wordpress.org/support/users/avalanchedigital/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/accessing-relevanssi-user-searches-programatically/#post-11229923)
 * Status: resolved