Cant move file after media_handle_upload
You’re doing it twice – media_handle_upload is a wrapper for wp_handle_upload. Just use the former like so: require_once ABSPATH . ‘wp-admin/includes/file.php’; $id = media_handle_upload( ‘custom_upload’, $post->ID, array(), // Attachment post data overrides, WordPress will do all the grunt work by default array( ‘test_form’ => false, ‘action’ => ‘editpost’, ) ); if ( ! is_wp_error( $id … Read more