WordPress 2.6 Tips and Tricks

Picked this up today via Amit Agarwal’s Digital Inspiration blog: brilliant stuff!

The WordPress tips and few hacks mentioned below may only apply to a self-hosted installation of WordPress version 2.6 or above.

*If your WordPress blog is hosted on wordpress.com, please skip this.

Tip 0: Change the Default Image Upload Folder

The default installation of WordPress will store all your images inside wp-content/uploads folder.

image-upload-folder

You can however use a different folder or even sub-domain on your web server for saving file uploads as in the setting screen above. This offers two advantages – your image URLs become relatively shorter and second, the size of your WordPress folder will always remain small and manageable.

Also deselect the option – “Organize my uploads into month- and year-based folders.”

Tip 1: Remove unnecessary code from your WordPress header.

WordPress by default adds a version number to the header of all your blog pages.

<meta name="generator" content="WordPress 2.5" />

This information may prove a goldmine for WordPress hackers as they can easily target blogs that are using the older and less secure versions of WordPress software. To completely remove the version number from WordPress header, add this line to your functions.php file in the WordPress themes folder.

<?php remove_action('wp_head', 'wp_generator'); ?>

Tip 2: Prevent people from casually browsing your WordPress Folders

Since you definitely don’t want Peeping Toms to navigate your WordPress files and folders using the explorer view in web browsers, add the following link to your .htaccess file that exists in the main WordPress installation directory.

Options All -Indexes

Tip 3: Windows Live Writer Templates & WordPress

If you not blogging via the Windows Live Writer client, add the following line to your functions.php file.

<?php remove_action('wp_head', 'wlwmanifest_link'); ?>

The WLW-Manifest function is used by Windows Live Writer to download the styles / themes used in your WordPress blog. Windows Live Writer users who do not use the live preview feature may also turn off this function.

Tip 4: Turn off Post Revisions in WordPress 2.6

WordPress 2.6 introduced Wikipedia style document revisions where you have access to all previous version of the document making it easy to revert incase you make any mistakes.

This may be a great feature for blogs where multiple authors work on the same blog post but 99% of WordPress users don’t need it. Post revisions also increase the size of WordPress wp_posts table as each revision means an additional row.

To disable post revisions in WordPress 2.6, add this to your wp-config.php file.

define('WP_POST_REVISIONS', false);

Tip 5: Disable HTML in WordPress Comments

The comment box is WordPress is like a basic HTML editor – people can use HTML tags like <b>, <a>, <i>, etc to highlight certain words in their comment or add live links. If you like to disable HTML in WordPress comments, add this to your functions.php

add_filter( 'pre_comment_content', 'wp_specialchars' );

Tip 6: Change location of the Plugins & WordPress Themes folder

With WordPress 2.6, you can place the wp-content folder anywhere on your web server. This may come handy when you are upgrading the WordPress installation because none of your existing themes and plug-ins will get overwritten even if you replace all the WordPress files with a tar downloaded from wordpress.org.

If you decide to move the wp-content folder to another location, specify the path in the wp-config.php file:

define(’WP_CONTENT_DIR’, ‘http://www.labnol.org/assets/wp-content’);

Tip 7: XML Sitemaps – Change the Building Mode

If you using XML Sitemaps plugin in WordPress, try changing the building mode to “manual.”

xml-sitemaps

When you publish (or delete) a blog post via the WordPress write panel, the entire XML sitemap is recreated from scratch and hence may increase the overall time it takes to publish a post as you’ll have to wait until the creation process is over.

Tip 8: Turn Off Image Thumbnails in WordPress (workaround)

disable-image-thumbnails When you upload an image to WordPress, it creates two additional thumbnail images in the uploads directory. I don’t know how to prevent WordPress from creating image thumbnails but there’s a workaround if you publish posts via Windows Live Writer.

Just use the FTP publishing option for images and this will automatically disable thumbnail creation because the upload happens through a different route.

Sarah News #2

On a good note, Sarah finally announced her plans for her future:

I want to be a forensic pathologist.

Hmm: now just where could that originate from?

Sarah News

Had to take Sarah to a doctor today as she had been complaining about stomach pains for the last couple of days.

Somehow I was just slightly bothered by the following comment:

What kind of iron supplement are you taking? It looks like you have lost quite of blood recently..

Iron supplement? Bl**dy hell: upon leaving the hospital six weeks ago, we were told “everything’s fine, have a good day!”

Just to put her situation into the right context: we’re talking about an iron infusion here.. :-(

Choices

It can be tough at times.

Have you ever stood in front of the buffet of a 5-star hotel and wondered what you should choose?

That’s the great thing about spending your summer vacation at home: Japanese? Italian? WTF: how about both?

Grilled Pepperonis, grilled Oyster Mushrooms, and a hell of a lot of California Rolls.

Magic, pure magic! :-)

Quote of the Day

Vic to Dad:

Hey Dad, I love talking to you: you really understand me! You know what: you could be gay!

Riiiight… ;-)

Background