Exports and Reports


Define custom exports / reports for users, based off of any MySQL SELECT query you create. This plugin interacts with your SELECT query and does all the hard work for you: exporting, pagination, ordering, searching/filtering, and display formatting for you.

All you do is install the plugin, create your Groups, create your Reports, and hand it off to your clients. Exportable reports in CSV, TSV, XML, JSON, and custom delimiter separated formats.

Please submit bug reports or contribute your own enhancements/fixes on GitHub.



  • Create and Manage Groups
  • Create and Manage Reports
  • Limit which User Roles have access to a Group or Report
  • Ability to clear entire export directory (based on logged export files)
  • Daily Export Cleanup via wp_cron
  • WP Admin UI – A class for plugins to manage data using the WordPress UI appearance


  • Filter by Date
  • Automatic Pagination
  • Show only the fields you want to show
  • Pre-display modification through custom defined function per field or row


  • CSV – Comma-separated Values (w/ Excel support)
  • TSV – Tab-separated Values (w/ Excel support)
  • TXT – Pipe-separated Values (w/ Excel support)
  • XLSX – Excel format, using PHP_XLSXWriter
  • XML – XML 1.0 UTF-8 data
  • JSON – JSON format
  • PDF – PDF printer friendly views, using TCPDF
  • Custom – Custom delimiter separated Values (Update the report screen URL parameters to &action=export&export_type=custom&export_delimiter=# and change # to whatever delimiter you want)

Cronjob / JSON API

  • Run the Export action for a specific report to any supported export type
  • Get paginated / full data from a report in JSON format


  1. Unpack the entire contents of this plugin zip file into your wp-content/plugins/ folder locally
  2. Upload to your site
  3. Navigate to wp-admin/plugins.php on your site (your WP plugin page)
  4. Activate this plugin

OR you can just install it with WordPress by going to Plugins >> Add New >> and type this plugin’s name


What are Groups?

Groups are groupings of Reports that are given their own menu item in the “Reports” menu.

What is a Report?

A Report is defined by a Custom MySQL query and can be configured to display however you wish using additional field definitions. Exports can be disabled per report.

My report isn’t working

As an admin, add &debug=1 to the end of the report URL to see the query that this plugin uses, take that query and use it in your own MySQL client or PHPMyAdmin to see if there are any errors in your own query.


Took me a while to notice the message: Success: Your export is ready, the download should begin in a few moments. If it doesn't, click here to access your TXT export file. When you are done with your export, click here to remove it, otherwise the export will be deleted within 24 hours of generation. PS. I’m using wpDataTables to publish CVS-file.
I was looking for a way to create reports from SQL directly and found this plugin. It is perfect for what I need and even has more options than I was hopping for.
For years, I've been using EZ SQL Reports Shortcode Widget and DB Backup plugin to create reports based on SQL queries. It's great but doesn't have export capabilities This Exports and Reports plugin SQL has solid export features. Documentation is a bit thin but it's a free plugin so I can't complain. 2 tips for everyone: 1) Remove the ; at then of your SQL queries 2) If the report returns nothing then add &debug=1 to the URL in order to show error messages.


“Exports and Reports” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。


Exports and Reports 外掛目前已有 1 個本地化語言版本。 感謝所有譯者為這個外掛做出的貢獻。

將 Exports and Reports 外掛本地化為台灣繁體中文版。


任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄



  • Fixed an issue with the XLSX PHP library having deprecated notices, updated it to latest released version.


  • Fixed a problem with backslashes in URLs for Windows file exports, props @ZelonGames [#16]
  • Removed jQuery UI Datepicker functionality and replaced with HTML input types date, time, and datetime-local. [#10]
  • Added support for numeric values in XLSX exports instead of treating them as strings for the export. [#18]
  • Updated compatibility with WP 5.7


  • Fixed a problem where the SQL upgrade would try to run after it’s already done the install and is already up-to-date
  • Updated compatibility with WP 5.5


  • Updated compatibility with WP 5.4


  • Fix some output escaping in the WP_Admin_UI class


  • Fixed multiple group pages not showing the correct group view for first group in list [#8]
  • Fixed export variable notices (props @rdaniel0) [#12]


  • Added new filter wp_admin_ui_export_pdf_report_file to override the default WP_Admin_UI_Export_PDF::CreateReport( $this ) process when creating PDF reports.
  • Fixed PDF report titles that said ‘item’ instead of the report title.


  • Moved install logic from init into activation hook, some times the plugin’s version option was coming up empty and causing DB table resets.
  • Implemented dbDelta function for schema modifications.


  • Added ability to export to TXT file (pipe-delimited)
  • Added ability to export to XLSX file
  • Added ability to export to PDF file
  • Lots of escaping improvements
  • PHPCS fixes and formatting
  • Other miscelaneous fixes and improvements to code quality


  • Fix for report dropdown link problem introduced in 0.7.3 (props @andrewgosali)


  • Added ability to set the ID field for a related table field (default was id, now you can customize it)
  • Fix for pagination LIMIT bug (props @andrewgosali)
  • Fix for is_plugin_active bug (props @skillio and @cvladan)
  • Fix for get_currentuserinfo deprecation error
  • Fixes for potential conflicts with other plugins that use the “export” and “download” URL parameters, they are now “exports_and_reports_export” and “exports_and_reports_download”
  • Some more minor escaping fixes


  • Fix for files not downloading completely (on some environments)
  • Additional escaping fixes for WP_Admin_UI (reported by Sathish Kumar from cybersecurity works)


  • Escaping fixes for WP_Admin_UI (reported by Sathish Kumar from cybersecurity works)


  • Added: Using WP AJAX URL instead of Admin.class.php directly for downloads of exports


  • Added: New constant to change the exports directory (WP_ADMIN_UI_EXPORT_DIR / WP_ADMIN_UI_EXPORT_URL)
  • Added: New filter to change the exported filename (wp_admin_ui_export_file, filter is passed filename and export type)
  • Added: Ability to use the API to export and then download the file (previously only JSON was available about file)
  • Added: New filter to override the WP_Admin_UI options array (exports_reports_report_options, filter is passed an array of options)
  • Fixed: JSON API for downloading data (full or paginated) now returns data properly, previously wasn’t returning the actual data


  • Security fix for orderby handling


  • Added: Export JSON response now includes export file and message OR Error message from Cronjob URL (props to @adminatvbds for the idea)


  • Fixed: How the token gets generated is more randomized now


  • Feature: Added new Cronjob URL which you can define report or export type (requires WP 3.5+)
  • Feature: Added new JSON API URL which you can define report, export type, and optional pagination (requires WP 3.5+)
  • Changed: Format of exported file names is now utilizing 24 hour format, along with a random string at the end
  • Fix: Tweaks to table markup


  • Fix for exporting and URL paths on Windows, props to @fantomas_bg


  • Bug fixes, added nonces for exports


  • Feature: Reports menu split from Reports Admin so they’re two separate menus now to avoid confusion for users
  • Feature: Ability to reorder Groups so you can choose the order they appear in the menu
  • Feature: Ability to set a separate query for use when getting the ‘total’ count (for advanced / complex queries which otherwise would be a bad idea to use SQL_CALC_FOUND_ROWS for)
  • Feature: Report field settings now have ‘Advanced’ section that can be expanded to view advanced settings, otherwise you can use the three simple settings which are ‘Field Name’, ‘Data Type’, and ‘Label (optional)’
  • Feature: Now when you don’t enter ANY fields in the Field Settings area, the report will pick up fields directly from the query for you when you display a report
  • Feature: When making a boolean data type field filterable, a new filter will appear to choose ‘– Show All –‘, ‘Yes’, and/or ‘No’
  • Feature: If you’re having trouble with a report, you can enable debug mode by adding debug=1 to the Report URL (must be Administrator)
  • Fix: Date fields that are empty (0000-00-00 00:00:00) will now show ‘N/A’ instead
  • Fix: Related fields have better handling for SQL building
  • Fix: No longer using default ORDER BY when no ORDER BY is found in SQL, causing issues with tables that didn’t have a field ‘id’ set
  • Fix: Smarter WHERE and HAVING dynamic building
  • Fix: Lots of PHP warnings / notice cleanups and general code tweaks to plugin and WP_Admin_UI class


  • Feature: Added ability to set the a field’s filter default value
  • Feature: Added additional ‘related’ field type options (where/order by SQL, related ON field)
  • Feature: Added ‘default_none’ option to DB and Report editor, which allows you to default a report to show no results until a search / filter is done, exports clicked will continue to generate the full export before search and/or filtering
  • Feature: EXPORTS_REPORTS_DISABLE_MENU constant added to disable the menu from being output completely (aside from the normal exports_reports_* capabilities you can define under user roles
  • Fix: Added comments to SQL Query field in Report editor to explain advanced %%TAGS%% which can be used
  • Fix: Reports list now ordered by Group then Weight (same for reordering)
  • Fix: Forcing version to be int instead of text when getting version from DB
  • Fix: Various minor bug fixes to plugin and WP Admin UI class


  • Bug fix for SQL (another)


  • Bug fix for SQL
  • Moved About to bottom of Menu
  • Added ‘Reset’ option in Settings


  • Fixed menu access


  • Upgraded Admin.class.php with Bug fixes and features (better UI and filtering)
  • Export data fixes on CSV / TSV to support Excel
  • Redefined Date Data Type into three (Date, Date + Time, Time)
  • Filter by Date
  • Ability to clear entire export directory (based on logged export files)
  • Daily Export Cleanup via wp_cron


  • First official release to the public as a plugin