Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I was wondering if there is a way to get the URL address to prepopulate with my web address so I don't have to type it in every time I want to insert an image.

Example.

Click on the upload/insert "add media" button --> click "from URL" and instead of having a blank box, I would like it to prepopulate with:

http://mysite.com/images/

this way the only thing I would have to type in is: nameofimage.jpg

share|improve this question
    
just wondering... did my answer help? –  Dean Taylor Apr 3 '12 at 19:40
add comment

1 Answer

You can apply a filter to the output of the media insert url form using the filter named wp_media_insert_url_form:

add_filter('wp_media_insert_url_form', 'ex46632_media_insert_url_form');
function ex46632_media_insert_url_form($html) {
    $html = str_replace('<input id="src" name="src" value=""', '<input id="src" name="src" value="http://mysite.com/images/"', $html);
    return $html;
}

Something like this could be added to your theme's functions.php file. This is untested code that is just as an example of direction.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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