From 36e4db6b01b4ffa56296d870f8f8978b0be5b85e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 16 May 2020 17:23:31 +0000 Subject: [PATCH] Media: Expose media grid frame via `wp-media-grid-ready` trigger for easier customization. Props soulseekah. Fixes #50185. git-svn-id: https://develop.svn.wordpress.org/trunk@47807 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/media.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/_enqueues/admin/media.js b/src/js/_enqueues/admin/media.js index 5bcad08ef6..8b603205f6 100644 --- a/src/js/_enqueues/admin/media.js +++ b/src/js/_enqueues/admin/media.js @@ -147,11 +147,14 @@ if ( $mediaGridWrap.length && window.wp && window.wp.media ) { settings = _wpMediaGridSettings; - window.wp.media({ + var frame = window.wp.media({ frame: 'manage', container: $mediaGridWrap, library: settings.queryVars }).open(); + + // Fire a global ready event. + $mediaGridWrap.trigger( 'wp-media-grid-ready', frame ); } // Prevents form submission if no post has been selected.