I'm trying to create a function that always inserts the full size image that was uploaded. My first thought was something like this:

function image_tag($id, $alt, $title, $align, $size) {
    $size = 'full';
    return $html;
add_filter('get_image_tag', 'image_tag', 10, 5);

Unfortunately that doesn't display anything on upload.

P.S. I do not want to have to manually set this is the Insert Media > Upload Files > Select Files > Attachment Display Settings > Size.

  • Can i just clarify what you mean, so when someone uploads an image into the editor (no matter the size settings) when the post is viewed that image on the front end will always be full size? Nov 9, 2017 at 13:48
  • @Jim-miraidev that's correct Nov 9, 2017 at 14:25
  • I have a JavaScript solution,which i can post if you want? Nov 10, 2017 at 16:54
  • did you find a solution? Nov 13, 2017 at 13:58

1 Answer 1


Not a PHP solution, but below is a jQuery option.

    var images = $('.entry-content img');

    images.each(function() {
        var src = $(this).attr('src'),
            // removes the  img size off the src e.g -300x300.
            newsrc = src.replace(/-\d+[Xx]\d+\./,'.');         

You would need to remove some of the classes e.g size-thumbnail

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.