How to open media frame of wordpress in frontend?

I am new in WordPress and I want to add the media frame in front end which opens in back-end of WordPress to my WordPress application.

To open it in backend I am using wp.media() function; but it is not working in Front end.

Related posts

1 comment

  1. I have got my answer and I am posting the solution so that if someone else need to use it he/she can use it.

    function add_media_upload_scripts() {
        if ( is_admin() ) {
             return;
           }
        wp_enqueue_media();
    }
    add_action('wp_enqueue_scripts', 'add_media_upload_scripts');
    

    Place this code in your Functions.php file.

Comments are closed.