Make WordPress Core

Changeset 61618

Timestamp:
02/12/2026 04:18:09 AM (3 weeks ago)
Author:
ramonopoly
Message:

WP_Theme_JSON: preserve valid non-preset settings for lightbox when KSES filters are active

Extends VALID_SETTINGS entries to also do type validation (as well as schema key validation) for the lightbox settings only.

Previously, when KSES filters were active (via add_action( 'init', 'kses_init_filters' )), valid non-preset settings in Global Styles were being incorrectly filtered out. For example, lightbox.enabled and lightbox.allowEditing for Image blocks.

The idea is that VALID_SETTINGS values can act as type validation for further valid settings.

Props ramonopoly, mmtr86, oandregal, wildworks, westonruter, andrewserong.

Fixes #64280.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r61607 r61618  
    396396     *              'typography.defaultFontSizes', and 'spacing.defaultSpacingSizes'.
    397397     * @since 6.9.0 Added support for `border.radiusSizes`.
     398
    398399     * @var array
    399400     */
     
    443444        ),
    444445        'lightbox'                      => array(
    445             'enabled'      => null,
    446             'allowEditing' => null,
     446            'enabled'      => ,
     447            'allowEditing' => ,
    447448        ),
    448449        'position'                      => array(
     
    13031304     *
    13041305     * @since 5.8.0
     1306
    13051307     *
    13061308     * @param array $tree   Input to process.
     
    13171319            if ( ! array_key_exists( $key, $schema ) ) {
    13181320                unset( $tree[ $key ] );
     1321
     1322
     1323
     1324
     1325
     1326
     1327
     1328
     1329
     1330
     1331
    13191332                continue;
    13201333            }
     
    37543767
    37553768    /**
     3769
     3770
     3771
     3772
     3773
     3774
     3775
     3776
     3777
     3778
     3779
     3780
     3781
     3782
     3783
     3784
     3785
     3786
     3787
     3788
     3789
     3790
     3791
     3792
     3793
     3794
     3795
     3796
     3797
    37563798     * Processes a setting node and returns the same node
    37573799     * without the insecure settings.
     
    38113853        // Ensure indirect properties not included in any `PRESETS_METADATA` value are allowed.
    38123854        static::remove_indirect_properties( $input, $output );
     3855
     3856
     3857
    38133858
    38143859        return $output;
  • trunk/tests/phpunit/tests/theme/wpThemeJson.php

    r61607 r61618  
    69066906        $this->assertSame( $expected, $theme_json->get_stylesheet( array( 'styles' ), null, array( 'skip_root_layout_styles' => true ) ) );
    69076907    }
     6908
     6909
     6910
     6911
     6912
     6913
     6914
     6915
     6916
     6917
     6918
     6919
     6920
     6921
     6922
     6923
     6924
     6925
     6926
     6927
     6928
     6929
     6930
     6931
     6932
     6933
     6934
     6935
     6936
     6937
     6938
     6939
     6940
     6941
     6942
     6943
     6944
     6945
     6946
     6947
     6948
     6949
     6950
     6951
     6952
     6953
     6954
     6955
     6956
     6957
     6958
     6959
     6960
     6961
     6962
     6963
     6964
     6965
     6966
     6967
     6968
     6969
     6970
     6971
     6972
     6973
     6974
     6975
     6976
     6977
     6978
     6979
     6980
     6981
     6982
     6983
     6984
     6985
     6986
     6987
     6988
     6989
     6990
     6991
     6992
     6993
     6994
     6995
     6996
     6997
     6998
     6999
     7000
     7001
     7002
     7003
     7004
     7005
     7006
     7007
     7008
     7009
     7010
     7011
     7012
     7013
     7014
     7015
     7016
     7017
     7018
     7019
     7020
     7021
     7022
     7023
     7024
     7025
     7026
     7027
     7028
     7029
     7030
     7031
     7032
     7033
     7034
     7035
    69087036}
Note: See TracChangeset for help on using the changeset viewer.