enter image description hereI've produced a custom area where media file url/location is saved using wordpress standard media gallery appear by clicking "place into publish" button. Below is my code to extract the road from the media file. Image url is working fine. But it's coming back only media title. I'm not sure how can i obtain the file path from.

jQuery(document).ready(function() {
    jQuery('#wsp_media_button').click(function() {
     formfield = jQuery('#wsp_media').attr('name');
     tb_show('', 'media-upload.php?TB_iframe=true&tab=library');
     return false;

    window.send_to_editor = function(html) {
        var imgurlar = html.match(/<img[^>]+src=\"([^\"]+)\"/);
        var imgurl = imgurlar[1];

        //html is returning only title of the media

        if( imgurl.length ){
        //other types of files
            var fileurl = jQuery(html);


When the user has not selected to incorporate a hyperlink URL when placing media (video, ebooks etc) then all that's passed into the editor may be the file title, that is what you're seeing.

Should you desired to always be sure that the file URL was delivered back, no matter what configurations the consumer has selected, or keep file URL inside a different format you are able to hook into two seperate filters.

Procedural setup:

    add_filter('media_send_to_editor', 'media_to_editor', 1, 3);
    add_filter('image_send_to_editor', 'image_to_editor', 1, 8);

For images, the filter function appears like the below:

image_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt){


For media accessories:

function media_to_editor($html, $send_id, $attachment ){        


So, you can, within individuals filters alter the adjust the information getting delivered back towards the editor to make certain it has the file URL. For media accessories, determine when the html features a file reference, and when not, add it back, and send that to the editor.

I am unsure however, you may do this

imgurl = jQuery('img',html).attr('src');

rather than

var imgurl = imgurlar[1];

Here's my complete function that I have utilized in on of my WordPress projects for any custom area

window.send_to_editor = function(html)
    imgurl = jQuery('img',html).attr('src');
    jQuery('#upload_image').val(imgurl); // '#upload_image' is my input(text) id where I recieve the image url after insert into post has been clicked.

and it is working perfectly.

It really works acceptable for me thanks! But my wordpress plugin does not add the look right into a publish, but into my configurations area. It is possible to method to alter the "place into publish" tex