Make WordPress Core

Changeset 38837


Ignore:
Timestamp:
10/20/2016 09:03:09 AM (8 years ago)
Author:
pento
Message:

Twenty Seventeen: Fix a PHP warning on fresh installs.

When setting the transport parameter on Customizer settings, we need to ensure the setting exists, particularly on new sites.

See #38372.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/inc/customizer.php

    r38833 r38837  
    1 <?php
     1 <?php
    22/**
    33 * Twenty Seventeen: Theme Customizer
     
    1414 */
    1515function twentyseventeen_customize_register( $wp_customize ) {
    16     $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
    17     $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
    18     $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
     16    $postMessage_settings = array( 'blogname', 'blogdescription', 'header_textcolor' );
     17    foreach( $postMessage_settings as $postMessage_setting ) {
     18        $setting = $wp_customize->get_setting( $postMessage_setting );
     19        if ( $setting ) {
     20            $setting->transport = 'postMessage';
     21        }
     22    }
    1923
    2024    /**
Note: See TracChangeset for help on using the changeset viewer.