WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So when I create a new post and I upload an image onto the my server.

Normally depending on the size of the image you can select small, medium, large image to place inside the post. On other sites that I have with Wordpress, if I select medium image and insert, Wordpress will place <a href="...uploads/full-size-img.jpg"><img src="medium.jpg"></a>. Then if I was to insert a full size image, Wordpress would know that I don't need the <a href="...upload/full-size-img.jpg"></a> around the full size image.

The problem I have at the moment is that now it always thinks I need an <a href="upload/full-size-img.jpg"></a> around all my images even if it is a full sized image already. When I select the none option in the inserting image popup window, the next time I try to insert a medium sized image, it doesn't detect that I would need the <a href="...uploads/full-size-img.jpg"><img src="medium.jpg"></a>.

I could keep changing the link option in the image inserting window, from "none" when it is full size image to "file URL" to when it's a medium sized image. But with my site I have 26 different writers so I would have to explain to all of them what to do.

share|improve this question

The following code will empty the Link URL field when Full Size button is clicked. And fill the same field with the File URL value when other buttons are clicked.

Tested with WordPress 3.4.2. Drop the code in your theme's functions.php file or create a simple plugin for it.

add_action( 'admin_head-media-upload-popup', 'wpse_41539_add_remove_image_url' );

function wpse_41539_add_remove_image_url() 
    // Don't run if viewing "From URL" tab
    if( 'type_url' != $_GET['tab'] ) 
        <script type="text/javascript">
        jQuery(document).ready( function($) 
             * If Full Image size selected, empty the URL field
                .find('tr.url td.field button.urlnone').click();

             * If other image sizes selected, fill the URL field with the File URL
             * Change "button.urlfile" to "button.urlpost" to use the Attachment Post URL
                .find('tr.url td.field button.urlfile').click();
share|improve this answer

Your Answer


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.