Skip Navigation

[Resolved] Can I save a list of the search terms used in a search field?

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 7 years, 2 months ago.

Assisted by: Beda.

Author
Posts
#485817

I am using Views to display a Search box and then return a table of results.

I would like to know if it would be possible to take the search terms entered by users and save them into a database table (or text file)?

This list would be very helpful as my client would then know; either what is popular, or what people are searching for that they don't have.

Any help would be very much appreciated.

#485908

No, that is not possible with the native Views/Toolset features.

What you theoretically can do, is store the URL parameters against the current logged in user, by using Custom Code.

This information could be stored in a User Custom Field, and then displayed with Views since it offers a way to display User Fields easily:
https://toolset.com/documentation/user-guides/displaying-wordpress-user-fields/

With the Custom Code I cannot assist, you would need to get the values of the Search URL parameters, and then update_user_meta() those User Fields on a certain action (as an example when the Search is submitted).
https://codex.wordpress.org/Function_Reference/update_user_meta

Keep in mind that Types User Fields will hold a prefix "wpcf-" which you need to add to your User Field Slug when addressing them with the above update_user_meta() function.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.