Skip to content

Commit

Permalink
REST API: Declare 'edit_css' capability in links within `WP_REST_Glob…
Browse files Browse the repository at this point in the history
…al_Styles_Controller`.

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

References:
* [WordPress/gutenberg#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
  • Loading branch information
VenusPR committed Feb 1, 2023
1 parent 0302b5b commit 587b086
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ protected function prepare_links( $id ) {
* 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.
*/
Expand All @@ -442,6 +443,10 @@ protected function get_available_actions() {
$rels[] = 'https://api.w.org/action-publish';
}

if ( current_user_can( 'edit_css' ) ) {
$rels[] = 'https://api.w.org/action-edit-css';
}

return $rels;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 587b086

Please sign in to comment.