1. RevDev
  2. Ask for Hooks and Filters [developers]
  3. Wednesday, 19 December 2018
  4.  Subscribe via email
Are there any specified functions or hooks for creating folders in code and to upload files into them? I need to create a frontend interface for users to upload files, and I want to separate the files in the media library. The "User folder" doesn't seem to fulfill my requirement, as the folder may be created before the user that will upload the files.
Responses (3)
Accepted Answer Pending Moderation
Hi,

Thanks for contacting us here about this extension.
Are there any specified functions or hooks for creating folders in code and to upload files into them?

You can try these functions below:
https://codex.wordpress.org/Function_Reference/wp_insert_term
https://codex.wordpress.org/Function_Reference/wp_set_object_terms

Hope it helps!
Cheers,
Accepted Answer Pending Moderation
Hi,

Currently we have no helpers for developers, but it's in the todo list, but you can still use WordPress functions to do what you want.

Folders uses the custom taxonomy "wpmf-category".
You can then create folder by using wp_insert_term with this taxonomy and set an attachment to a folder using wp_set_object_terms.

In addition, you can have a look on the existing hooks here https://www.joomunited.com/wp-media-folder-developer-documentation

Best regards
Accepted Answer Pending Moderation
Thank you. I suspected it wasn't much more complicated than that, but code-diving it myself probably would have taken longer than this.
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.