Support

Account

Home Forums Backend Issues (wp-admin) Add category to file and filter media library Reply To: Add category to file and filter media library

  • The media library is only shown for those that can have access to it. If the user is a subscriber or some other type of user that is not allowed to edit media then the simple upload field will be used. Try testing this by logging in as the user type you plan on allowing this form for.

    Also when creating a field you can specify to only allow files that are attached to the post.

    As far as adding a specific category when the file is uploaded. I’m not entirely sure you can do that. You might try creating either an acf/pre_save_post http://www.advancedcustomfields.com/resources/acf-pre_save_post/ or an acf/save_post http://www.advancedcustomfields.com/resources/acfsave_post/ action. I’m not sure which one would be better for this. In this action you’d need to get the attachment ID value from the ACF field and then add the category to the attachment post using wp_set_object_terms() https://codex.wordpress.org/Function_Reference/wp_set_post_terms