Skip to content

Instantly share code, notes, and snippets.

@taggon
Last active February 20, 2017 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taggon/009cc7baa372b3431074723b57c7bf13 to your computer and use it in GitHub Desktop.
Save taggon/009cc7baa372b3431074723b57c7bf13 to your computer and use it in GitHub Desktop.
Small JS code for selective refresh
( function( api ){
if ( !api ) {
return;
}
api.bind( 'partial-content-rendered', function( placement ) {
var idBase = placement.partial && placement.partial.widgetIdParts && placement.partial.widgetIdParts.idBase || '';
if ( 'wp-media-widget' === idBase ) {
wp.mediaelement.initialize();
}
} );
} )( window.wp && wp.customize && wp.customize.selectiveRefresh );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment