Close featured image modal windows with JS

[ad_1]

Hello there,

I’m developing a plugin which let you select a fectured image for a post from an external resource e.g. an API

When I select an image, I want the image select window to close. I have tried with:

wp.media.view.Modal.close()

But it throws me an error in console:

wp.media.view.Modal.close is not a function

How can I close this windows from code?

Thank you in advance!

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer