wp_mail attachment not working in wordpress

You don’t need to know the file names before, you’ll have access to them. I saw you using $subject = $_POST[‘subject’]; – this means the subject will be the value of the input with the name of “subject”. In your case, this one : <input id=”subject” class=”form-control” name=”subject” type=”text” /></div> We can use the same … Read more

Disable Attachment Page Except for Category

The problem is that is_category does not do what you thought it does. is_category( ‘keep’ ) tests that the current page is a category archive for the category keep, it does not check if the current attachment/post is in the keep category. The official WordPress developers docs for is_category start with: Determines whether the query … Read more

Media library upload hook

I think what you need is media_upload_{$type} hook. Here’s the documentation for it: https://developer.wordpress.org/reference/hooks/media_upload_type/ There’s also an easier way to achieve a similar result, by using the filter wp_handle_upload which is really straightforward. Here’s the doc about it: https://developer.wordpress.org/reference/hooks/wp_handle_upload/ If you could provide more details about the result you want to achieve, I’ll try my … Read more