is there any updated guide?
str opened this issue · 2 comments
I got here because I'm looking to use wp.media
but this guide looks outdated and when running the examples I get a lot of errors, specially TypeError: wp.media.frame is undefined
.
Because WordPress is backward-compatible and this API is still in use by 100s of plugins, this content is still up-to-date. It doesn't account for Gutenberg features.
As described by the guide, wp.media.frame
is:
"A reference to the last media frame instantiated via wp.media()
So it's entirely possible that it is undefined.
Hi @str - sorry for the delay in getting back to you.
@sxalexander is correct, it is entirely possible wp.media.frame is undefined
if the media modal has not been opened yet. Here's a screen recording where I see the value is undefined
, open the modal and then see the value reflect the instance of the frame which was opened:
I'm going to close this issue for now. Feel free to reopen in case I missed anything!