Hi Everyone,

We can get many tutorial and article in making selective referesh on customizer, which is introduced on WordPress Version 4.5.
Here is the answer of the question if you find your customizer selective referesh is now working even you followed the whole procedure that is given on wordpress codex or by many of our Admin member.

First create a function which is hooked on customize_register
function yourthemeslug_customize_register( $wp_customize ) {

$wp_customize->get_setting( ‘blogname’ )->transport = ‘postMessage’;
$wp_customize->get_setting( ‘blogdescription’ )->transport = ‘postMessage’;
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( ‘blogname’, array(
‘selector’ => ‘.site-title a’,
‘container_inclusive’ => false,
‘render_callback’ => ‘caveat_customize_partial_blogname’,
) );
$wp_customize->selective_refresh->add_partial( ‘blogdescription’, array(
‘selector’ => ‘.site-desc a’,
‘container_inclusive’ => false,
‘render_callback’ => ‘caveat_customize_partial_blogdescription’,
) );
add_action( ‘customize_register’, ‘yourthemeslug_customize_register’ );

Conclusion: Many of us follow this whole procedure, will be stuck when we are defining are whole container or class for blog title and tagline. If after we followign this whole procedure our customier preview is not working then we need to check our for class taht are using on selector arguments. For both blogname and blogdescription we need to check for the class that we have enclosed them adn should specify on selector arguments. Have a look on this example.

<h1 class=”site-title”><a href=”<?php echo esc_url( home_url( ‘/’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></a></h1>
<h2 class=”site-desc”><a href=”<?php echo esc_url( home_url( ‘/’ ) ); ?>” rel=”home”><?php bloginfo( ‘description’ ); ?></a></h2>
If you find any problems on this please feels free to contact me or post a comment.