Support » Developing with WordPress » media_handle_sideload does not go through upload_dir hook

  • dduvacher


    I’m using media_handle_sideload in a custom endpoint to handle base64 media upload.
    I’ve a function that modify the upload directory. This function works well when I use media_handle_upload.

    But when I’m using media_handle_sideload, it looks like the hook it’s not triggered.
    Is it a normal behavior ?


Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    No, the hook should work with either method. The sideload process eventually ends up calling _wp_handle_upload() as well, in which wp_upload_dir() is called, which applies the “upload_dir” filter.

    It may be your theme or a plugin is hijacking the sideload process, or is otherwise overriding the filter when sideloading. You can use the troubleshooting tab of the Health Check plugin, or selectively disable components manually to narrow down the cause.

Viewing 1 replies (of 1 total)
  • The topic ‘media_handle_sideload does not go through upload_dir hook’ is closed to new replies.