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 and ryanwelcher committed Dec 20, 2022
1 parent e211c87 commit 6ce4f45
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 6ce4f45

Please sign in to comment.