selective_refresh issue
-
So, I am having an issue with selective refresh, it refreshes the previewer when it’s located in a function, like so:
function text_controller( $setting_id, $section_id, $label = '', $description = '', $default = '', $selector = '', $transport = true, $sanitize = 'sanitize_text_field' ) { global $wp_customize; if( $transport ) { $transport_type = 'postMessage'; } else { $transport_type = 'refresh'; } $wp_customize->add_setting( $setting_id, array( 'default' => $default, 'sanitize_callback' => $sanitize, 'capability' => 'edit_theme_options', 'transport' => 'postMessage', ) ); $wp_customize->add_control( $setting_id, array( 'label' => $label, 'description' => $description, 'section' => $section_id, 'settings' => $setting_id, ) ); $wp_customize->selective_refresh->add_partial( $setting_id, array( 'selector' => $selector, 'render_callback' => function( $setting_id ) { return get_theme_mod( $setting_id ); }, ) ); }
I paste all the variables to this function, selective refresh works for like a second and then it refreshes the previewer.
If I do the cod outside the function it works.
I think it has something to do with this part:
`
‘render_callback’ => function( $setting_id ) {
return get_theme_mod( $setting_id );
},Any suggestions? Thank you!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘selective_refresh issue’ is closed to new replies.