Skip to content
Docs
Get RestroPress

Filter

rpress_export_capability

Updated
On this page

Filters whether the current user is allowed to run CSV exports.

Runs when an exporter checks permission before sending data, and when the batch export processor decides whether a requested export class may run. The default is whether the user has the export_shop_reports capability. Return true to also allow another group of users, or false to block exports.

Parameters#

ParameterTypeDescription
$can_exportboolWhether the current user has the export_shop_reports capability.

Return value#

bool. True to allow the export.

Example#

function my_allow_settings_managers_to_export( $can_export ) {
	return $can_export || current_user_can( 'manage_shop_settings' );
}
add_filter( 'rpress_export_capability', 'my_allow_settings_managers_to_export', 10, 1 );

Notes#

Fired from RPRESS_Export::can_export() for the legacy exporters and from the batch export permission check for the AJAX batch exporters.

Source#

Applied in:

  • includes/admin/reporting/class-export.php (line 34), in RPRESS_Export::can_export()
  • includes/admin/reporting/export/export-functions.php (line 39), in rpress_is_allowed_export_class()

See also#

Was this page helpful?