A Few WordPress Tips, Hacks and Tricks

Snippets | By | 4 November 2010 | Comments 5

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:

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

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:

http://wpzine.com/?preview=1&template=twentyten&stylesheet=twentyten

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:

remove_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!):

add_filter('privacy_on_link_text', 'privacy');
function 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

DELETE FROM wp_posts WHERE post_status='trash';

Remove All Spam And Trash Comments

DELETE 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:

remove_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.



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

5 Comments

  • November 4, 2010
    • November 4, 2010
  • November 5, 2010
  • November 12, 2010
  • November 18, 2010

Leave A Comment.