WP_REST_Edit_Site_Export_Controller::permissions_check() – Checks whether a given request has permission to export.

You appear to be a bot. Output may be restricted

Description

Checks whether a given request has permission to export.

Usage

$WP_Error|true = WP_REST_Edit_Site_Export_Controller::permissions_check();

Parameters

Returns

WP_Error|true True if the request has access, or WP_Error object.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php


Lines:

1 to 12 of 12
  public function permissions_check() {
    if ( current_user_can( 'edit_theme_options' ) ) {
      return true;
    }

    return new WP_Error(
      'rest_cannot_export_templates',
      __( 'Sorry, you are not allowed to export templates and template parts.' ),
      array( 'status' => rest_authorization_required_code() )
    );
  }
 

 View on GitHub View on Trac