Upload file without attaching it to a POST
-
07-11-2019 - |
题
I've brought files with html file field and I'm trying to attach file to wordpress attachments using media_handle_upload
$attach_id = media_handle_upload ( $file_handler, null );
the I've specified second parameter as null
because I don't want to attach it with any post, but it returns some WP Error, since it is may be not allowed to media_handle_upload
without post id
WP_Error Object
(
[errors] => Array
(
[upload_error] => Array
(
[0] => Array
(
[0] => 0
[1] => 0
[2] => 0
)
)
)
[error_data] => Array
(
)
)
is it possible to upload images with wordpress default without assigning it to any post?
没有正确的解决方案