previews – customizer refresh doesnt reflect values


brand new wordpress install, removed default: plugins, posts, pages and the additional themes other than twenty twenty-one.
(this way pretty much anyone can reproduce the issue)
created and activated a minimal child theme where style.css has only this:

Theme Name: Twenty Twenty-One child
Template: twentytwentyone

and functions.php has only this:

add_action( 'customize_register' , function($wp_customize){
        'type'      => 'theme_mod',
        'transport' => 'refresh',
        'default'   => false
        'title' => 'foo'
        'label' => 'enable/disable parking page',
        'type'  => 'checkbox',
        'section' => 'my_section'
        echo 'hello am a parking page';

when I goto customise foo section and tick the checkbox, nothing reflects in the preview side.
I publish the change and check the website and as expected nothing appears other than the custom “parking message”
I reopen customise then goto foo section again, the preview at this point has nothing other than the “parking message” I untick the checkbox, and the preview reflects that this time.
why the preview only reflects the change as expected when I untick the checkbox but not the other way around ?

Amine Tbaik 1 year 2021-11-28T17:42:40-05:00 0 Answers 0 views 0

Leave an answer