diff --git a/lib/class-wp-rest-menu-items-controller.php b/lib/class-wp-rest-menu-items-controller.php index 11e9542..6feac30 100644 --- a/lib/class-wp-rest-menu-items-controller.php +++ b/lib/class-wp-rest-menu-items-controller.php @@ -383,7 +383,7 @@ protected function prepare_item_for_database( $request ) { foreach ( array( 'menu-item-xfn', 'menu-item-classes' ) as $key ) { $value = $prepared_nav_item[ $key ]; if ( ! is_array( $value ) ) { - $value = explode( ' ', $value ); + $value = wp_parse_list( $value ); } $prepared_nav_item[ $key ] = implode( ' ', array_map( 'sanitize_html_class', $value ) ); } @@ -711,7 +711,7 @@ public function get_item_schema() { 'context' => array( 'view', 'edit', 'embed' ), 'arg_options' => array( 'sanitize_callback' => function ( $value ) { - return array_map( 'sanitize_html_class', explode( ' ', $value ) ); + return array_map( 'sanitize_html_class', wp_parse_list( $value ) ); }, ), ); @@ -779,7 +779,7 @@ public function get_item_schema() { 'context' => array( 'view', 'edit', 'embed' ), 'arg_options' => array( 'sanitize_callback' => function ( $value ) { - return array_map( 'sanitize_html_class', explode( ' ', $value ) ); + return array_map( 'sanitize_html_class', wp_parse_list( $value ) ); }, ), );