Hacks to boost your WordPress 2.7 blog
Wordpress 2.7 is overall great and I recommend you to downloand and upgrade. There are however some fixes and recommendations I deem as important.
Solving problem with duplicated URLs with comment paging
Wordpress 2.7 introduced a new way of displaying comments that is turned on by default.
Unfortunately the way that this was constructed is leading to duplicate pages of your posts in Google - something that is not optimum.
If you have a Wordpress theme that is not using the new comment system and you did not change any settings you will anyway be affected (as this blog was).
Already 1,5 million of these duplicate pages can be seen in Google. Try to see your own site with [site:yoursite.com inurl:comment-page-1]
Why is this bad:
- It can affect your ranking in search engines. Google is complaining via the Google Webmaster tools.
- People can get confused and link to the wrong URL when linking to your blog.
- It can have a negative effect on plugins using statistics as well as caching.
This is a bug ticket for this but the status has been closed and I think that the developers didn't really understood the problem.
Solution
Until there is a good solution for this either in the core or as a plugin I recommend you to turn off the comment setting below that unfortunately has been put on by default. (This is under Settings --> Discussion)
If you have that turned off those duplicated URLs will 301 redirect back to the normal URLs.
Adding meta-robots tags noindex on these pages or blocking them in the robots.txt is not a sufficient good solution in my opinion on reasons 2 and 3 above.
Others about this problem:
- Quick Online Tips: WordPress Comment Pagination Causes Duplicate Content Pages
- Kaizeku Ban: Prevent Duplicate Content on Comment Paging
Solving problem with mass creation of revision posts
This is another feature that is default turned on that was not introduced by 2.7 but actually by 2.6.
If you didn't know it already a lot of versions of your posts are stored in the database growing it at a high speed. It could be many thousands. One person reported:
[...] Blog Posts: 2,506 Last Blog ID: 13,577 - OZtwo
I deleted all those on on my friends database and the database went from 12 MB down to 3 MB. This is a big deal but there are no button to turn it off. And the developers has said:
[...] This isn't going to be in the core any time soon, because most of the developers don't see the point. [...] - Otto24
So if you don't need thousands of revision posts in your database and autosave every 60 seconds here is the solution
Add the following lines in the config.php:
define('AUTOSAVE_INTERVAL', 200 ); // seconds
define('WP_POST_REVISIONS', false );
Then after that open up PHPMyAdmin or in other way run this SQL-query:
DELETE FROM wp_posts WHERE post_type = "revision";
There is also a plugin with the name Revision Control but if you have simple done the above I don't see the need for that plugin.
Adding buttons for h2 and h3
I have never really understood why Wordpress don't have buttons (quicktags) for making subheadings when writing posts. Clearly the <h1> is for the title of the page and should be automatically generated by the theme. Subheadings are, as all people who know HTML, h2-h6. Clearly there should be buttons for this but there isn't and never have been.
Solution
So instead of having to do it manually every time simply download my edited version of quicktags.js, unpack the zip file and upload and overwrite the file located in this folder: /wp-includes/js/. This has been tested and works with 2.7 and probably for many versions above that as well. Unfortunately you will have to do this after each upgrade until someone writes a simple plugin for this. (If you write a plugin, comment below.)
Showing Gravatars
I think that it is time to show gravatars on your blog. And if you don't have a picture yourself, you should add an image now. It is great for branding and even if a blog does not yet display gravatars they are shown on the dashboard.
To display gravatars on your Wordpress 2.7 blog you should first tweak some settings under Settings -> Discussion and scroll down to Avatars.
If you have a modern theme using the new wp_list_comments code then you just have to set the right arguments.
This would for example display only comments (no trackbacks or pingbacks) and with gravatar size of 50:
<?php if(function_exists('get_avatar')) { echo get_avatar($comment, '50'); } ?>
There is very little documentation yet on this tag but some more info can be found here, here and here. I guess to style the comments you would need something called a custom callback function in your functions.php.
For those of us who prefer to stay with the old fashioned comment_text and so forth there is a code supported since Wordpress 2.5 called get_avatar:
<?php if(function_exists('get_avatar')) { echo get_avatar($comment, '60'); } ?>
The number is the dimension of the image in pixels.
There is also a plugin for this, although I like to edit the code myself. Here are some advice on that, just add some CSS.
My personal recommendations is to display the gravatars on the left side, using "Blank" as the default and having a link with a text to the signup under the comment form.
Plugins to protect comment spam broken?
Plugins such as WP-SpamFree and Math Comment Spam Protection are not working with Wordpress 2.7.
Solution
Install Bad Behavior which can be used together with Akismet, it is really good.
A tip from WP Recipes is to also add the following lines in your .htaccess but don't forget to specify your domain on line 4:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*yourblog.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
The above lines will block referers to wp-comments-post.php which is not coming from your domain.
More tricks with .htaccess for Wordpress can be found here and here.
Plugins to boost your Wordpress blog
These are the ones I highly recommend.
- WP Super Cache
- WordPress.com Stats
- Bad Behavior
- Subscribe to Comments
- All in One SEO Pack
- WordPress Related Posts
- FeedBurner FeedSmith
- Redirection
- Dagon Design Sitemap Generator
My other articles about Wordpress
- SEO for WordPress - The Complete Guide
- Link to Me Textbox WordPress Plugin
- Tutorial: Automatic Site Map for WordPress
- WordPress users - sharpen your URLs with Google!
- Optimizing performance for WordPress 2.7
- 10 Killer WordPress Hacks
- 8 Useful WordPress SQL Hacks
- Mastering Your WordPress 2.7 Theme & Admin Area: Tips and Tricks
- WordPress Optimization Bible
Please comment to improve this article.
Other posts
- My Recommendations for a Happy Life
- Budget 100 - an old school magic format
- My Favorite Board Games and How I Play Them
- Switching from Windows PC to Mac and why I switched back
- Creating The Space War - The Card Game of My Dreams
- 24 Characteristics That Geniuses Have in Common
- Setting up and Managing a MySQL Server
- Canasta - The Great Card Game
- Annual report number 13 + 14: My Success
- Selling my SEO business TodaysWeb
He is the Founder of DomainStats and N.nu. Read his full about page.