Title: Filter export example
Last modified: April 2, 2021

---

# Filter export example

 *  Resolved [growinsane](https://wordpress.org/support/users/growinsane/)
 * (@growinsane)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/filter-export-example/)
 * Hi there,
    Your example of exporting says to append the parameters as follows:&
   action=export&export_type=custom&export_delimiter=# Is there a parameter to supply
   a field? So for example can I 1. Setup the query as : SELECT * FROM wp_postmeta
   WHERE %%WHERE%% 2. Setup a number field as post_id and then report out with json
   using this post_id field like so? report=#&full=1&action=json&token=#&export_type
   =json&post_id=100000 This didn’t work but this be done? David, Thanks,

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

 *  Thread Starter [growinsane](https://wordpress.org/support/users/growinsane/)
 * (@growinsane)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/filter-export-example/#post-14268689)
 * Just as work around to doing this (because I could not see evidence it was possible)
   
   If in the API.php file this line : $options[‘sql’] = trim( $report_data[‘sql_query’]);
 * is substituted with this block :
 *  $ID = absint( $_GET[‘ID’] );
    if (empty($ID)) { $options[‘sql’] = trim( $report_data[‘
   sql_query’] ); } else{ $options[‘sql’] = ‘select * from (‘ . trim( $report_data[‘
   sql_query’] ) . ‘) as X where ID = ‘ . $ID; }
 * …it then becomes possible to supply ID as a parameter in the query string and
   provided the saved report includes a column with name or alias ‘ID’ it will subquery
   against the report. I am not sure if this breaks other functionality but it worked
   for me. It could be refined if performance is critical as it is querying what
   would be an unrestrained subquery.
 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [5 years ago](https://wordpress.org/support/topic/filter-export-example/#post-14336942)
 * Have you tried adding ID as a field/column not shown/exported, but filterable?
   Then you could do this without any workarounds.

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

The topic ‘Filter export example’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/exports-and-reports.svg)
 * [Exports and Reports](https://wordpress.org/plugins/exports-and-reports/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/exports-and-reports/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/exports-and-reports/)
 * [Active Topics](https://wordpress.org/support/plugin/exports-and-reports/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/exports-and-reports/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/exports-and-reports/reviews/)

## Tags

 * [export](https://wordpress.org/support/topic-tag/export/)
 * [field](https://wordpress.org/support/topic-tag/field/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)

 * 2 replies
 * 2 participants
 * Last reply from: [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/filter-export-example/#post-14336942)
 * Status: resolved