Make WordPress Core


Ignore:
Timestamp:
02/01/2023 06:36:08 PM (2 years ago)
Author:
hellofromTonya
Message:

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:

  • 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php

    r54817 r55177  
    432432     *
    433433     * @since 5.9.0
     434     * @since 6.2.0 Added 'edit-css' action.
    434435     *
    435436     * @return array List of link relations.
     
    441442        if ( current_user_can( $post_type->cap->publish_posts ) ) {
    442443            $rels[] = 'https://api.w.org/action-publish';
     444        }
     445
     446        if ( current_user_can( 'edit_css' ) ) {
     447            $rels[] = 'https://api.w.org/action-edit-css';
    443448        }
    444449
Note: See TracChangeset for help on using the changeset viewer.