Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Commit aa5242a

Browse files
committed
Use wp_parse_list over explode.
1 parent f1ee75a commit aa5242a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/class-wp-rest-menu-items-controller.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ protected function prepare_item_for_database( $request ) {
383383
foreach ( array( 'menu-item-xfn', 'menu-item-classes' ) as $key ) {
384384
$value = $prepared_nav_item[ $key ];
385385
if ( ! is_array( $value ) ) {
386-
$value = explode( ' ', $value );
386+
$value = wp_parse_list( $value );
387387
}
388388
$prepared_nav_item[ $key ] = implode( ' ', array_map( 'sanitize_html_class', $value ) );
389389
}
@@ -711,7 +711,7 @@ public function get_item_schema() {
711711
'context' => array( 'view', 'edit', 'embed' ),
712712
'arg_options' => array(
713713
'sanitize_callback' => function ( $value ) {
714-
return array_map( 'sanitize_html_class', explode( ' ', $value ) );
714+
return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
715715
},
716716
),
717717
);
@@ -779,7 +779,7 @@ public function get_item_schema() {
779779
'context' => array( 'view', 'edit', 'embed' ),
780780
'arg_options' => array(
781781
'sanitize_callback' => function ( $value ) {
782-
return array_map( 'sanitize_html_class', explode( ' ', $value ) );
782+
return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
783783
},
784784
),
785785
);

0 commit comments

Comments
 (0)