Thursday, November 4, 2010

A Few Wordpress Tips, Hacks and Tricks | WPZine

A Few WordPress Tips, Hacks and Tricks

Snippets | By Paul Maloney | 4 November 2010 | Comments 1

Today I thought I would show you a few tips, hacks and tricks that will help make your WordPress install more secure, tidy and offer a little in the way of customization.

Please be sure to backup any files before you start editing, it’s better to be safe than sorry.

Remove Plugin And Update Counts

On some occasions you might feel the need to remove the counts for your plugins and updates, whether it is through personal preference or you don’t want your clients updating things unsupervised.

To do this just add this snippet into your functions.php file (back it up first!!) and the counts will magically disappear:

1add_action('admin_menu', 'remove_counts');
2function remove_counts(){
3global $menu,$submenu;
4$menu[65][0] = 'Plugins';
5$submenu['index.php'][10][0] = 'Updates';
6}

Preview a Theme Without A Plugin

When installing new themes it can be useful to preview the theme before making it “live”, there are plugins that allow you to do this, but by far the easiest way is to do it like this:

Remove Autolinks In Comments

WordPress by default automatically converts any URLs in comments to click-able links, I don’t need to explain why this could be bad for your blog, so to disable this you can add the following to your functions.php file:

1remove_filter('comment_text', 'make_clickable', 9);

Alter The Search Engines Blocked Text

You can alter the default “Search Engines Blocked” message in your WordPress admin panel by adding a custom message to your functions.php file (remember to backup first!):

1add_filter('privacy_on_link_text', 'privacy');
2function privacy() {_e('Bots Blocked');};

Database Cleanup

WordPress by default holds onto many spam and trashed posts and comments in the database, you can clear these up my running a few SQL queries, you need to backup your database before you start, then run the following queries:

Remove All Trashed Posts

1DELETE FROM wp_posts WHERE post_status='trash';

Remove All Spam And Trash Comments

1DELETE FROM wp_comments WHERE comment_approved IN ('spam', 'trash');

(Note if your table structure is not the default you must alter the wp_ part of the query to suit)

Remove The WordPress Version

In your source you will see the version of WordPress you are running, for security this being visible isn’t a good thing, there again are plugins that offer this but you can add this snippet to your functions.php file to rid this from your blog:

1remove_action('wp_head', 'wp_generator');

Conclusion

These snippets are very easy to implement and shouldn’t take more than a few seconds to do, they can save you time and keep your install running smooth.

logo

11diggsdigg

Paul Maloney

Paul Maloney is a UK based web designer/developer and runs the design agency Tropica. He particularly enjoys using and working with WordPress and has a keen interest in typography. You can also follow Paul on Twitter.

Visit Paul Maloney's website

Tags: , ,

No comments:

Post a Comment