[wp-trac] [WordPress Trac] #14134: Menus item are limited to 16 item and will not save more than that
WordPress Trac
noreply at wordpress.org
Fri Mar 4 06:54:41 UTC 2016
#14134: Menus item are limited to 16 item and will not save more than that
--------------------------+------------------------
Reporter: jaanfx | Owner: ericlewis
Type: defect (bug) | Status: reopened
Priority: high | Milestone: 4.5
Component: Menus | Version: 3.0
Severity: major | Resolution:
Keywords: | Focuses:
--------------------------+------------------------
Changes (by keraweb):
* status: closed => reopened
* resolution: fixed =>
Comment:
@ericlewis
I think I have found my problem and sollution as stated in the comment
before.
Changed code: starting from '''line 61''' in '''nav-menus.php'''
{{{#!php
<?php
if ( preg_match( '#(.*)(?:\[(\w+)\])#', $post_input_data->name, $matches )
) {
if ( empty( $_POST[ $matches[1] ] ) ) {
$_POST[ $matches[1] ] = array();
}
if ( is_numeric( $matches[2] ) ) {
$matches[2] = intval( $matches[2] );
}
$_POST[ $matches[1] ][ $matches[2] ] = wp_slash(
$post_input_data->value );
} else {
$_POST[ $post_input_data->name ] = wp_slash(
$post_input_data->value );
}
}}}
The menu locations are associative arrays and the preg_match you've made
('#(.*)(?:\[(\d+)\])#') targeted only digits. Changed "d+" to "w+" to
solve this.
After that, if $matched[2] is a numeric I've still made it an integer.
With this changes both integers and strings can be used in array keys.
Can you please review this code? I really like to see this working 100% in
the 4.5 release.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/14134#comment:208>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list