Make WordPress Core

Changeset 36613


Ignore:
Timestamp:
02/22/2016 07:54:39 PM (9 years ago)
Author:
ericlewis
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/nav-menus.php

    r36510 r36613  
    6060            // For input names that are arrays (e.g. `menu-item-db-id[3]`), derive the array path keys via regex.
    6161            if ( preg_match( '#(.*)(?:\[(\d+)\])#', $post_input_data->name, $matches ) ) {
    62                 if ( empty( $_POST[$matches[1]] ) ) {
    63                     $_POST[$matches[1]] = array();
     62                if ( empty( $_POST[ $matches[1] ] ) ) {
     63                    $_POST[ $matches[1] ] = array();
    6464                }
    65                 $_POST[$matches[1]][(int)$matches[2]] = $post_input_data->value;
     65                $_POST[ $matches[1] ][ (int) $matches[2] ] = wp_slash( $post_input_data->value );
    6666            } else {
    67                 $_POST[$post_input_data->name] = $post_input_data->value;
     67                $_POST[ $post_input_data->name ] = wp_slash( $post_input_data->value );
    6868            }
    6969        }
Note: See TracChangeset for help on using the changeset viewer.