Make WordPress Core


Ignore:
Timestamp:
11/28/2021 01:51:23 PM (3 years ago)
Author:
audrasjb
Message:

Editor: Ensure block style name does not contain spaces before creating the class.

This change adds a check to ensure there is no spaces in block style variation names before generating the class. Returns false and a _doing_it_wrong() message if a space is detected.

Props amustaque97, costdev, hellofromtonya, pbiron, SergeyBiryukov, afragen.
Fixes #54296.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-styles-registry.php

    r52236 r52261  
    5959                __( 'Block style name must be a string.' ),
    6060                '5.3.0'
     61            );
     62            return false;
     63        }
     64
     65        if ( str_contains( $style_properties['name'], ' ' ) ) {
     66            _doing_it_wrong(
     67                __METHOD__,
     68                __( 'Block style name must not contain any spaces.' ),
     69                '5.9.0'
    6170            );
    6271            return false;
Note: See TracChangeset for help on using the changeset viewer.