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.

Built from https://develop.svn.wordpress.org/trunk@36613


git-svn-id: http://core.svn.wordpress.org/trunk@36580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Eric Lewis 2016-02-22 19:55:28 +00:00
parent eba32e3b6f
commit 360a30d55e
2 changed files with 5 additions and 5 deletions

View File

@ -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 );
}
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36612';
$wp_version = '4.5-alpha-36613';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.