wordpress snippets last updated   : August 18, 2014
we now have 638 snippets

Upload user-submitted files from the frontend

wordpress snippet

There are many use cases for allowing users to upload files from the frontend, but the trick is making sure the file is uploaded and saved in the WordPress media library correctly. You can easily use standard PHP functions to handle the upload and then store the file wherever you like, but then you won’t be able to take advantage of the attachment system that WordPress uses. An image that is uploaded correctly, for example, will have all the various sizes available as well as the meta data, such as title, description and caption. You will also be able to edit all of this from the media library in your WordPress dashboard.

read more

Remove image sizes from media upload gallery

wordpress snippet

This snippet will let you remove image sizes from media upload gallery very similar to a recent post that will show you how to add custom image sizes to the media upload gallery.

read more

Restrict uploads to specified file types only, jpg, gif

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will allow you to restrict uploads to an array of specified mime types only. This sample only allows jpg and gif images, adding a new line for png eg: ‘png’ => ‘image/png’, would then allow png images.

read more

Disable flash media file uploader

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will disable the flash media uploader.

read more

Let contributors upload files

wordpress snippet

Adding this PHP code to the functions.php of your wordpress theme will allow contributors to upload files.

read more

Allow more filetype uploads

wordpress snippet

Adding this PHP code to your functions.php will allow you to define other file types you can upload to wordpress separating each file type by a vertical pipe.

read more
jqsnipp.com | we just launched jquery snippets website