Customize: Prevent PHP warning in applying widget starter content on fresh installs.
Fixes PHP warning triggered by calling `max()` on `$widget_numbers` when there are no widget instances of the type yet. Also makes sure that widget instances start at 2 instead of 1. See #38114. Built from https://develop.svn.wordpress.org/trunk@39100 git-svn-id: http://core.svn.wordpress.org/trunk@39042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ceeb8ddb46
commit
c0b41d8fee
|
@ -928,8 +928,12 @@ final class WP_Customize_Manager {
|
||||||
|
|
||||||
// Find the max widget number for this type.
|
// Find the max widget number for this type.
|
||||||
$widget_numbers = array_keys( $settings );
|
$widget_numbers = array_keys( $settings );
|
||||||
$widget_numbers[] = 1;
|
if ( count( $widget_numbers ) > 0 ) {
|
||||||
$max_widget_numbers[ $id_base ] = call_user_func_array( 'max', $widget_numbers );
|
$widget_numbers[] = 1;
|
||||||
|
$max_widget_numbers[ $id_base ] = call_user_func_array( 'max', $widget_numbers );
|
||||||
|
} else {
|
||||||
|
$max_widget_numbers[ $id_base ] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$max_widget_numbers[ $id_base ] += 1;
|
$max_widget_numbers[ $id_base ] += 1;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-beta1-39099';
|
$wp_version = '4.7-beta1-39100';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue