REST API: Declare 'edit_css' capability in links within `WP_REST_Global_Styles_Controller`.

Updates the Global Styles endpoint to expose the `'edit_css'` capability via action links.

References:
* [https://github.com/WordPress/gutenberg/pull/46815 Gutenberg PR 46815] Part of an effort to hide custom CSS setting for users without `'edit_css'` capability.

Follow-up to [52342], [52051].

Props mamaduka, dsas, glendaviesnz, mmtr86, talldanwp, timothyblynjacobs.
Fixes #57526.
Built from https://develop.svn.wordpress.org/trunk@55177


git-svn-id: http://core.svn.wordpress.org/trunk@54710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2023-02-01 18:38:14 +00:00
parent 263ef5505d
commit 96f54a8132
2 changed files with 6 additions and 1 deletions

View File

@ -431,6 +431,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
* Get the link relations available for the post and current user.
*
* @since 5.9.0
* @since 6.2.0 Added 'edit-css' action.
*
* @return array List of link relations.
*/
@ -442,6 +443,10 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
$rels[] = 'https://api.w.org/action-publish';
}
if ( current_user_can( 'edit_css' ) ) {
$rels[] = 'https://api.w.org/action-edit-css';
}
return $rels;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-55176';
$wp_version = '6.2-alpha-55177';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.