inside a metabox

It’s not the right approach, since you are in a post(cpt) edit page the metabox’s are simple grouped fields that get attached to the post form and in your case it’s actually the browser who is filtering your metabox’s form attributes and not WordPress since you are creating nested forms which is something that you just can’t do.

A better approach would be to not have the form inside a metabox but outside here is an example using the native thickbox:

First add the button to lanch the thickbox:

//add the button to lanch the thickbox
add_action( 'media_buttons','add_vimeo_upload_button',100);

function add_vimeo_upload_button(){

    global $pagenow,$typenow;   

    if (!in_array( $pagenow, array( 'post.php', 'post-new.php' ) ))
        return;
    echo '<a href="#TB_inline?height=155&width=300&inlineId=vimeo_upload" class="thickbox"><img src="http://i.imgur.com/5hyoa.png" alt="Upload to vimeo"></a>';
}

Add form html outside post form ex:

//add form html outside post form
add_filter('admin_footer','vimeo_upload_form');

function vimeo_upload_form(){
    global $pagenow,$typenow;   
    if (!in_array( $pagenow, array( 'post.php', 'post-new.php' )))
        return;

//once we get here we are on the right page so we echo form html:
?>
<div id="vimeo_upload" style="display:none">
    <form method="POST" action="vimeo/url">
        <p><label>Upload video to Vimeo</label>
            <input type="file" name="" value="" placeholder=""></p>
        <p><input type="submit" name="" value="upload"></p>
    </form>
</div>
<?php
}

You should get something like this:

  • The media button:

    Upload to vimeo button

  • The form in thickbox:

    Upload to vimeo thickbox

Leave a Comment