WORDPRESS CODE SNIPPETS

Protect wordpress against malicious URL requests

protect-wordpress-against-malicious-url-requestsFantastic snippet from Perishable Press this snippet is great for the security to protect wordpress against malicious URL requests. I have attached a zip file with a download of this snippet as a plugin. Just ftp the single php file to your plugins folder and active as normal. ( download )

Read more…




Disable dragging of metaboxes within admin

disable-dragging-of-metaboxes-within-adminAdding this snippet to the functions.php of your wordpress theme will disable all dragging of metaboxes within the admin. Please note that this includes dashboard widgets as well.

Read more…




Limit number of classes when using post_class

limit-number-of-classes-when-using-post_classAdding this snippet to the functions.php of your wordpress theme will let you limit the number of classes displayed when using post_class, Yes this only works if you are using post_class() within your theme enjoy.

Read more…




Setup whitelist body_class to remove unwanted classes

setup-whitelist-body_class-to-remove-unwanted-classesAdding this snippet to the functions.php of your wordpress theme will let you create a white-list of terms to include in body_class. This is a great way to filter out many of the unwanted classes added

Read more…




Set the content type email from text/plain to text/html

set-the-content-type-email-from-textplain-to-texthtmlAdding this snippet to the functions.php of your wordpress theme will let you set the content type of email from text/plain to text/html.

Read more…




Remove support for specific post type features

remove-support-for-specific-post-type-featuresAdding this snippet to the functions.php of your wordpress theme will remove support for the specific features bellow from specified post types. Change the word ‘post’ to anything you like including a custom post type name or the default post, page.

Read more…




Display user with the most comments with count, email, author url

display-user-with-the-most-commentsAdding this snippet to the functions.php of your wordpress theme will let you display the top commenter list of users. Use $result->comment_author_email, $result->comments_count, $result->comment_author_url, to add additional parameters to this snippet.

Read more…




Add custom post types to archives page

add-custom-post-types-to-archives-pageAdding this snippet to the functions.php of your wordpress theme will let you add custom post types to archives page.

Read more…




Remove menu items from 3.3 admin bar

remove-menu-items-from-3-3-admin-barAdding this snippet to the functions.php of your wordpress theme will remove menu items from the wordpress 3.3 admin bar.

Read more…