Restrict file uploads by extension?

Is there a way in WordPress 3.1 to restrict allowed file uploads by extension (images only) and file size? Bonus question: Can I limit users to only be able view files they have uploaded themselves? 1 Answer 1 I believe you can add a filter to upload_mimes to restrict to certain types. The hook: … Read more

Loop through all media library images and return those where caption contains the text carousel

Im new to WordPress but I’m looking for a way to loop through all the images that have been uploaded to the media library and output the SRC, description and caption of the image when the caption contains the word ‘carousel’. Is this possible? 1 Answer 1 You could do this pretty easily with a … Read more

Making the Add Media Link URL into a checkbox

Hopefully it’s OK asking a second question pretty much directly after the first one… I’m currently having some difficulties accomplishing this: I’ve been able to remove the ‘Attachment Post URL’ button using function medium_attachment_fields_to_edit($form_fields) { $form_fields[‘url’][‘html’] = preg_replace(“/<button type=”button” class=”button urlpost” title=”(.)*”>(.*)<\/button>/”, “”, $form_fields[‘url’][‘html’]); return $form_fields; } add_filter(‘attachment_fields_to_edit’, ‘medium_attachment_fields_to_edit’, 0, 2); but I’m somehow unable … Read more

Pages redirected to attachment post

THE SETUP I’m using WordPress 3.4.2 with Magic Fields 2 plugin. Using MagicFields2, I’ve added a custom field to the builtin ‘page’ post type. This field is called ‘section_header’ (which is basically just an attachment post type). My permalink structure is /%category%/%postname%/. THE PROBLEM Sometimes, when I try to view a page with a ‘section_header’ … Read more