If you always want a page refresh, then all you have to do is simply remove this line:
$wp_customize->get_setting( 'blogname' )->transport="postMessage";
Or explicitly set it to refresh
:
$wp_customize->get_setting( 'blogname' )->transport="refresh";
By doing this, selective refresh will never get invoked to refresh the partial, and it will skip straight to the full refresh.
Note it is preferable to return false
in the render_callback
to indicate you want to trigger a refresh. In your example, it is actually causing a fatal error because there is no such method. The same fallback behavior to do a full refresh is still happening when returning false
or causing a fatal error, but in the latter case your error log is getting filled up.
In short, your example can be modified to:
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.logo a',
'render_callback' => '__return_false',
) );