wordpress snippets last updated   : January 28, 2015
we now have 645 snippets
category admin

Create custom terms admin column

wordpress snippet

create-custom-terms-admin-column

    This is a simple little snippet that will add your custom terms in an admin column. I added both the filter and action for both posts and pages, feel free to use both or choose one. Add this snippet to the functions.php of your wordpress theme but be sure to change TERM_NAME on this line echo the_terms( $id, 'TERM_NAME', '', ', ' ) in the snippet to the name of your term. You will then see your terms displayed exactly the same way as you see categories displayed within the admin section.

    read more

    Sharpen Resized WordPress uploaded Images (jpg only)

    wordpress snippet

    This great snippet by Unsal Korkmaz that will sharpen resized images uploaded to wordpress (jpg only). This is a great way to fix blurry jpg thumbnail images. If you would rather use this as a plugin you can now download it from the WordPress plugin directory.

    read more

    Add and remove wordpress user roles

    wordpress snippet

    With WordPress you can add and remove roles very easily. The first snippet will add a new role called “manager” with some basic capabilities. You can view the WordPress roles and capabilities page for more extensive details on the capabilities available that you can assign to a custom role. The second snippet will remove some of the existing roles “editor, author, contributor, subscriber” however this could also remove a custom role. NOTE: if you remove an existing role it will be gone! So please be careful when removing roles.

    read more

    Set default attachment display settings, alignment, link to, size in wordpress

    wordpress snippet

    Have you ever wanted to change the default options when inserting media into a post? Setting the default alignment to “left” or the default size to “large” ? This may not appear to be a big deal but if you are constantly changing the settings to the same thing over and over again for each image this is a must have snippet. We are updating the options “image_default_align, image_default_link_type, image_default_size”. Keep in mind that this just changes the default settings of these options within the add media popup. The method we use to update these options can be used for a number of other options including what you can find in this options reference.

    read more

    Show absolutely all custom fields for each post

    wordpress snippet

    This snippet will display absolutely all custom fields for each post. Even custom fields you may not even be aware exist like _edit_lock and others. We have Justin Sternberg to thank for writing this snippet that was submitted a while ago as part of his tutorial on wordpress custom fields. Since this snippet is not available other than in the tutorial I figure it should be posted separately.

    read more

    Change wordpress admin post columns order

    wordpress snippet

    I have needed to move a post column like “date, tags, author” or even a custom column within the wordpress admin. This is a simple method that I used to change the order of columns within the admin. What you have is two variables you will need to change $move and $before. Move is the name of the column you would like to move. Before is the name of the column you would like to move it before. The following snippet will let you move the author column before the post title column.

    read more