wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Attachment window hide buttons and input fields

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will allow you to hide buttons and input fields within the media attachment window.

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

Add custom tab to featured image media library popup

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add a new tab to the featured image popup called mime types. Clicking on this tab will display a list of the allowed file types however this could be changed to display almost any information.

read more

Display list of allowed mime types get_allowed_mime_types

wordpress snippet

Adding this snippet to your wordpress theme will display a list of available mime types allowed by wordpress.

read more

Add file type category within the media library

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add a new file type category within the media library for application/x-shockwave-flash mime type. This is a great snippet when you have a lot of files so that you can sort by category.

read more

Custom metabox listing all audio files from media library

wordpress snippet

I wrote this for a recent project because a client needed an easy way to attach audio files to the post without custom fields complicating things. Adding this snippet to the functions.php of your wordpress theme will add a metabox to your post editing screen with a select menu containing all audio files. Add the second snippet to display the specified audio URL in your wordpress theme.

read more