Add multipart-form/data encoding to WordPress admin forms

This is a little snippet that I use all the time.

This handy bit of code lets you upload files in the WordPress admin area when you are editing forms. I use it with custom metaboxes but you can use it with anything that you want to.

function admin_enc_tag () {
	echo ' enctype="multipart/form-data"';
} // admin_enc_tag ()

add_action ('post_edit_form_tag', 'admin_enc_tag');

Leave a Reply

Your email address will not be published. Required fields are marked *