Skip to content

Commit f6cf8fa

Browse files
committed
REST API: Add export rel link for active theme response.
The `targetHints.allow` value is used by the Site Editor to enable/disable the theme export feature. Props mamaduka, wildworks. Fixes #57379. git-svn-id: https://develop.svn.wordpress.org/trunk@60984 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d3c1b8b commit f6cf8fa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,15 @@ protected function prepare_links( $theme ) {
414414
);
415415
}
416416

417+
if ( $theme->is_block_theme() && $this->is_same_theme( $theme, wp_get_theme() ) ) {
418+
$links['https://api.w.org/export-theme'] = array(
419+
'href' => rest_url( 'wp-block-editor/v1/export' ),
420+
'targetHints' => array(
421+
'allow' => current_user_can( 'export' ) ? array( 'GET' ) : array(),
422+
),
423+
);
424+
}
425+
417426
return $links;
418427
}
419428

0 commit comments

Comments
 (0)