$_FILES is empty when working with wordpress custom field image uploading but, its working in core php website $_FILES is empty when working with wordpress custom field image uploading but, its working in core php website wordpress wordpress

$_FILES is empty when working with wordpress custom field image uploading but, its working in core php website


Adding the following hook in the functions.php file solves the problem.

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


remove action

<form enctype="multipart/form-data" method="post" action="">