Thickbox hacking – removing fields

Tricky but once you understand how WordPress sets the sizes and the fields then the rest is easy:

function thickbox_fields($form_fields, $post){
    unset(
        $form_fields['post_title'], //disables "Title" field and so forth...
        $form_fields['url'],
        $form_fields['image_alt'], 
        $form_fields['post_excerpt'], 
        $form_fields['post_content'], 
        $form_fields['align'], 
        $form_fields['image-size']
    );

    //create the size input for full only and set display to none
    $size="full";
    $css_id = "image-size-{$size}-{$post->ID}";
    $html = "<div style="display: none;" class="image-size-item"><input type="radio" name="attachments[$post->ID][image-size]" id='{$css_id}' value="{$size}"checked='checked' /></div>";
    //set as image-size field
    $form_fields['image-size'] = array(
        'label' => '', //leave with no label
        'input' => 'html', //input type is html
        'html' => $html //the actual html
    ); 

    return $form_fields;
}

First you remove all unwanted fields, then you mimic the way WordPress creates the sizes field but only with full as the selected option and you hide that using display:none

and then you add it to the fields array in the way WordPress Accepts and as you can see its not just a simple string but an array of parameters (label,input,html)

Now for the real question: who is the girl in the image???

Leave a Comment