
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.
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';
}
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
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);
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');};
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)
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');
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.
Great tips! I learned something new today from you about how to preview a theme with just a link. Never did have the chance to try it out till today.
Just a little question on doing cleanups. Why bother doing sql queries when you can just navigate into your trash and spam sections?
WordPress tends to keep some trash in the DB even after deletion, just keeps it all clean
Thanks for this, especially the tips about cleaning the database. My host frowns on large databases so I appreciate all the help I can get in this regard.
I think I found the resource I was looking for desperately Thanks for sharing
Great resource, worth while for people to know about the sql clean up!
Trackbacks