Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Gravity Forms - Export ONLY the search results WordPress


(i changed the question)

I suggested to my client, rather than filter the entries in the form of separate columns (my previous question that was not solved), just export the search results to a file (csv or xls format), this will solve my problem.

By default, GF plugin exports the data from ALL fields,
So, I need then is to search, and export the results thereof.


Answers (3)


Rashid Aliyev answers:

Please give more information

Ayres Landal comments:

I use this plugin to store entries of a models website.
For every entry, i have multiple fields to identify every model.

i need to filter the entries with more search fields,
or more words inside the field.

by default, i only can filter by one column (example: city)

i need to do searchs like: from city and ethicity

if isn't possible,
another solution fot he client is export the search
(by default, the GF plugin export to CSV all entries), and he wants only the results of the search)

i dont know what solution is the easier,
any of the two is good for me


Rashid Aliyev comments:

Why You do not use Custonm Fields or custom taxomies?

Rashid Aliyev comments:

You can use jQuery or ready plugin wich called "Custom Fields Template". It's got it's own example but if you wish, i can send many others made by me on internet.

Ayres Landal comments:

if i use custom fields/taxonomies,

there's a way to put the post fields in the front-end?
(in a sign-up page)


how i export the search results (inside the posts list) to a file (csv or xls)
if i can do this, this solve my client problem..



Oleg Butuzov answers:

i think year... just trace the query variable...

add_filter('query', 'customquery');
function customquery($sql){
// check is it gravityforms query
// for example by table
// modify it and return

return $sql;


John Cotton answers:

Do you mean in the Gravity Forms list of entries?

If so, the SQL that performs the search is on line 1508 of forms_model.php in the plug-in directory. This is it:
$sql = "
SELECT filtered.sort, l.*, d.field_number, d.value
FROM $lead_table_name l
INNER JOIN $lead_detail_table_name d ON d.lead_id =
SELECT @rownum:[email protected] + 1 as sort, id
SELECT distinct
FROM $lead_table_name l
INNER JOIN $lead_detail_table_name d ON d.lead_id =
WHERE l.form_id=$form_id
ORDER BY $sort_field $sort_direction
LIMIT $offset,$page_size
) page
) filtered ON =
ORDER BY filtered.sort";

return $sql;

Modifying that will affect the search results. However, if you wanted to <em>display</em> more fields as well, then you'd need to make mods elsewhere too.

Ayres Landal comments:

yes, i just want to insert more search fields to filter the entries.


only export to csv a list of entries that i've filtered.