Make WordPress Core

Changeset 53075


Ignore:
Timestamp:
04/05/2022 11:47:14 AM (3 years ago)
Author:
youknowriad
Message:

Block Editor: Synchronize global styles endpoint code with Gutenberg.

This adds a missing fallback to ensure styles property is always defined in the returned data.

Props gziolo.
See #55505.

File:
1 edited

Legend:

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

    r53072 r53075  
    583583        if ( rest_is_field_included( 'styles', $fields ) ) {
    584584            $raw_data = $theme->get_raw_data();
    585             if ( isset( $raw_data['styles'] ) ) {
    586                 $data['styles'] = $raw_data['styles'];
    587             }
     585            $data['styles'] = isset( $raw_data['styles'] ) ? $raw_data['styles'] : array();
    588586        }
    589587
Note: See TracChangeset for help on using the changeset viewer.