equal
deleted
inserted
replaced
48 /** |
48 /** |
49 * Checks whether a given request has permission to export. |
49 * Checks whether a given request has permission to export. |
50 * |
50 * |
51 * @since 5.9.0 |
51 * @since 5.9.0 |
52 * |
52 * |
53 * @return WP_Error|true True if the request has access, or WP_Error object. |
53 * @return true|WP_Error True if the request has access, or WP_Error object. |
54 */ |
54 */ |
55 public function permissions_check() { |
55 public function permissions_check() { |
56 if ( current_user_can( 'edit_theme_options' ) ) { |
56 if ( current_user_can( 'export' ) ) { |
57 return true; |
57 return true; |
58 } |
58 } |
59 |
59 |
60 return new WP_Error( |
60 return new WP_Error( |
61 'rest_cannot_export_templates', |
61 'rest_cannot_export_templates', |
68 * Output a ZIP file with an export of the current templates |
68 * Output a ZIP file with an export of the current templates |
69 * and template parts from the site editor, and close the connection. |
69 * and template parts from the site editor, and close the connection. |
70 * |
70 * |
71 * @since 5.9.0 |
71 * @since 5.9.0 |
72 * |
72 * |
73 * @return WP_Error|void |
73 * @return void|WP_Error |
74 */ |
74 */ |
75 public function export() { |
75 public function export() { |
76 // Generate the export file. |
76 // Generate the export file. |
77 $filename = wp_generate_block_templates_export_file(); |
77 $filename = wp_generate_block_templates_export_file(); |
78 |
78 |