Skip to content

Commit

Permalink
Global Styles REST API endpoint: check custom CSS is included before …
Browse files Browse the repository at this point in the history
…attempting to validate (#46561)

* Global Styles REST API endpoint: check custom CSS is included before attempting to validate

* Fix linting issue
  • Loading branch information
andrewserong authored Dec 15, 2022
1 parent b856a3f commit 489d48a
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,12 @@ protected function prepare_item_for_database( $request ) {
if ( isset( $request['styles'] ) || isset( $request['settings'] ) ) {
$config = array();
if ( isset( $request['styles'] ) ) {
$config['styles'] = $request['styles'];
$validate_custom_css = $this->validate_custom_css( $request['styles']['css'] );
if ( is_wp_error( $validate_custom_css ) ) {
return $validate_custom_css;
$config['styles'] = $request['styles'];
if ( isset( $request['styles']['css'] ) ) {
$validate_custom_css = $this->validate_custom_css( $request['styles']['css'] );
if ( is_wp_error( $validate_custom_css ) ) {
return $validate_custom_css;
}
}
} elseif ( isset( $existing_config['styles'] ) ) {
$config['styles'] = $existing_config['styles'];
Expand Down

0 comments on commit 489d48a

Please sign in to comment.