Customize: Ensure `header_image_data` setting exists before attempting to use it.

Amends [27497].
Props Collizo4sky.
Fixes #41007.


git-svn-id: https://develop.svn.wordpress.org/trunk@40935 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-06-25 07:03:16 +00:00
parent 84fa8a9ff1
commit 51be161019
1 changed files with 6 additions and 1 deletions

View File

@ -1321,7 +1321,12 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
* @param WP_Customize_Manager $wp_customize Customize manager.
*/
public function customize_set_last_used( $wp_customize ) {
$data = $wp_customize->get_setting( 'header_image_data' )->post_value();
$header_image_data_setting = $wp_customize->get_setting( 'header_image_data' );
if ( ! $header_image_data_setting ) {
return;
}
$data = $header_image_data_setting->post_value();
if ( ! isset( $data['attachment_id'] ) ) {
return;