I need to edit a plugin for my website. The plugin uses wp.media function and lets user upload images from the frontend.

A user should be able to upload multiple images. But, I need to set limit on the number of images based on user role.

I tried searching a lot for wp.media function options but I could not find the solution.

I already tried using wp_handle_upload_prefilter filter. It works within posts & pages. But, it is not working with this plugin because it is using wp.media function.

How can I limit the number of images an user can upload using wp.media() function?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.