0

I have two controls, one of which depends on another to show up:

   $wp_customize->add_section(
        'woo_enchancements',
        [
            'title' => __( 'WooCommerce Enchancements', '_amnth' ),
            'priority' => 32,
            'active_callback' => 'is_woocommerce_active',
            'description' => 'Must refresh the page after tweaking settings to see effects.'
    ]
);

$wp_customize->add_setting(
    'load_woo_custom_functionality',
    [
        'default' => '0',
        'transport' => 'refresh'
    ]
);

$wp_customize->add_control(
    new WP_Customize_Control(
        $wp_customize,
        'load_woo_custom_functionality_control',
        [
            'label'  => __( 'Load up Woo Enchancements?', '_amnth' ),
            'section' => 'woo_enchancements',
            'settings' => 'load_woo_custom_functionality',
            'type' => 'checkbox',
        ]
    )
);

$wp_customize->add_setting(
    'display_woo_header',
    [
        'default' => '0',
        'transport' => 'refresh'
    ]
);

$wp_customize->add_control(
    new WP_Customize_Control(
        $wp_customize,
        'display_woo_header_control',
        [
            'label'  => __( 'Display Woo Header?', '_amnth' ),
            'section' => 'woo_enchancements',
            'settings' => 'display_woo_header',
            'type' => 'checkbox',
            'active_callback' => 'is_woocommerce_enchanced'
        ]
    )
);

display_header depends on load_woo_custom_functionality to load, but when I set the value of display_header and I uncheck load_woo_custom_functionality, the value still remains when it should default to what is default for it - in this case, 0.

Here's an illustration of what happens:

Customizer not flushing conditioned controls values

It doesn't. How can I make sure this happens?

1 Answer 1

0

I later found out that, indeed, the values are flushed, but you can only see the effect after you've closed the customizer (a refresh).

There's no need for any flushing functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.