Skip to content
Docs
Get RestroPress

Filter

rpress_import_capability

Updated
On this page

Filters whether the current user may run a batch import.

Used by the base batch import class to decide whether an import can proceed. The default is the result of current_user_can() for the manage_shop_settings capability. If it returns false the AJAX handler responds with a permission error.

Parameters#

ParameterTypeDescription
$can_importboolWhether the current user has the importer's capability (manage_shop_settings by default).

Return value#

bool. True to allow the import, false to deny it.

Example#

function my_import_capability( $can_import ) {
	return current_user_can( 'manage_options' );
}
add_filter( 'rpress_import_capability', 'my_import_capability' );

Notes#

Applies to every importer extending RPRESS_Batch_Import. The result is cast to bool.

Source#

Applied in:

  • includes/admin/import/class-batch-import.php (line 107), in RPRESS_Batch_Import::can_import()

See also#

Was this page helpful?