I was trying to get the URL of the uploaded image via media uploader option "Insert from URL"

enter image description here

I use and below code, It works for just for "Insert Media",

    var abc = wp.media.frames.abc = wp.media({
            frame:    'post',
            state:    'insert',
            library: { type: 'image' },
            editing:   false,
            multiple: false,

        abc.on( 'insert', function() { 
            json = fn.state().get( 'selection' ).first().toJSON();

How can I get the URL from tab "Insert from URL", When user insert URL & click on Add Image/Insert in Page?

Any suggestions. Thanks in advance. :)

1 Answer 1


Got the solution...!

Use fn.state('embed' insted of fn.on( 'insert'
Or use Both of them fn.state('embed' & fn.on( 'insert'

fn.state('embed').on( 'select', function() {
    var state = fn.state(),
        type = state.get('type'),
        embed = state.props.toJSON();

    // SHOW JSON for embeded URL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.