How do i add edit shortcut icon in wordpress without using selective refresh

There is a simple way to do this by using __return_false . The downside is you get a double refresh as it checks for a partial and then returns “false” which results in a full refresh. This is problematic if you are using javascript only to show a “realtime” preview. In that case, you’d have to go with Weston Ruter’s solution.

If you are not actually using a postMessage preview and just want the shortcut to show up, then it is not a big deal as you need the full refresh anyway.

I am not sure why they haven’t built in these partial edit shortcuts for those using javascript only.

In kirki:

'transport' => 'postMessage',    
'partial_refresh' => array(
            'about_us_video_setting' => array(
                'selector' => '#youtube-video',
                'render_callback' => '__return_false'
            )
        )

Standard:

$wp_customize->get_setting( 'about_us_video_setting' )->transport="postMessage";

$wp_customize->selective_refresh->add_partial( 'about_us_video_setting', array(
            'selector' => '#youtube-video',
            'render_callback' => '__return_false',
        ) );

error code: 523