Last active
February 20, 2017 13:12
-
-
Save taggon/009cc7baa372b3431074723b57c7bf13 to your computer and use it in GitHub Desktop.
Small JS code for selective refresh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( 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