From 572578b8f12f195859662a02e626741acb7f3333 Mon Sep 17 00:00:00 2001 From: Eric Andrew Lewis Date: Mon, 22 Feb 2016 19:54:39 +0000 Subject: [PATCH] Menus: Ensure backslashes are saved in menu item fields. This was a regression introduced in [36510] which caused menu item fields to not save field content with backslashes in them. Props westonruter. See #14134. git-svn-id: https://develop.svn.wordpress.org/trunk@36613 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/nav-menus.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/nav-menus.php b/src/wp-admin/nav-menus.php index 7a6a18c8ad..2ab63343ee 100644 --- a/src/wp-admin/nav-menus.php +++ b/src/wp-admin/nav-menus.php @@ -59,12 +59,12 @@ if ( isset( $_POST['nav-menu-data'] ) ) { foreach ( $data as $post_input_data ) { // For input names that are arrays (e.g. `menu-item-db-id[3]`), derive the array path keys via regex. if ( preg_match( '#(.*)(?:\[(\d+)\])#', $post_input_data->name, $matches ) ) { - if ( empty( $_POST[$matches[1]] ) ) { - $_POST[$matches[1]] = array(); + if ( empty( $_POST[ $matches[1] ] ) ) { + $_POST[ $matches[1] ] = array(); } - $_POST[$matches[1]][(int)$matches[2]] = $post_input_data->value; + $_POST[ $matches[1] ][ (int) $matches[2] ] = wp_slash( $post_input_data->value ); } else { - $_POST[$post_input_data->name] = $post_input_data->value; + $_POST[ $post_input_data->name ] = wp_slash( $post_input_data->value ); } } }