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.

Jim Westergren is a company owner from Sweden who lives together with his wife and son. Some of his interests are SEO, web development, writing and
Sorry to those who tried to comment and received an error.
The comments are now working again.
Brilliant summary man; a very useful resource, going to have to implement that ‘comment’ hack to prevent indexing of further pages…or as an alternative I could just turn off pagination for now :p
btw thanks for the link.
I also spotted this problem with duplicate content and comment pagination: http://www.malcolmcoles.co.uk/blog/wordpress-comment-pagination-and-duplicate-content/
I’ve managed to solve it for pages two and higher of the standard loop by using the $paged variable: http://www.malcolmcoles.co.uk/blog/avoid-duplicate-meta-descriptions-in-pages-2-and-higher-of-the-wordpress-loop/
But I can’t work out how to do it for the comment loop.
@malcolm coles,
As soon you find a solution for those that want it turned on please comment here and I will include it in my article, with link of course.
Hi Jim – as requested! I tracked down the cpage variable, which lets you do the same sort of thing as I did with $paged.
You can see my solution here: http://www.malcolmcoles.co.uk/blog/wordpress-comment-pagination-and-duplicate-content/
For paginated comments, it adds ‘ – page X’ to the (HTML) title of pages 2 or higher, thus ensuring that there is a unique title in google.
You can use the same trick with meta descriptions, although this will depend on how yours are generated. (EG if you use an SEO plugin for meta description, the trick won’t work).
Oops. That’s the wrong link! The solution is here, sorry:
http://www.malcolmcoles.co.uk/blog/avoid-duplicate-content-paged-comments-wordpress-27/
Hi Malcolm,
I looked at your solution and what it does is to add extra words in for example title tag and meta-tags for the paginated pages.
However, that is not a sufficient good solution in my opinion as you still have several URLs for the same blog post.
A good solution would be to terminate those extra URLs and instead use for example AJAX to dynamically display the paginated comment pages but without leaving the URL of the article. You agree?
Not sure what google would make of the Ajax solution …
Anyway, if you combine the unique title and meta description approach I suggested with this idea:
http://pressedwords.com/solving-wordpress-seo-paged-comments-problem/
you should get round the problem.
The pressedwords solution puts the excerpt rather than the full post on comment pages two or higher. This makes the pages unique – they have one sentence (the excerpt) that is the same at the top. But google won’t mind that as the rest of the page – the comments – is unique.
And then add my PHP as well and you have unique content, title and meta description.
PS Although this won’t, admittedly, solve the problem of which URL people link to …
very nice post .. i liked it .. thnx!
I only found out about that duplicate content issue here. Thanks for the solution. My blog was “infected,” now, it’s cured.
i never thought that this will cause a duplicate content, though this is never a problem on my blog since I only received few comment and sometimes none. Thanks for the info.
im using 2.6 is it problem for this?
@ismail, What are you referring to? The duplicate content issue? No.
When I use code: , there is no option to show other gravatar default picture like wavatar for commentator who has not sign up for gravatar. Any suggestion? Thanks
@Rudi,
You do that in the admin under Settings -> Discussion.
Great article. Thank you.
You may wish to add a fix for the WordPress 2.7 bug that results in many RSS feed readers being unable to read the RSS feed for comments when default permalinks are used.
See my blog post on the subject ( http://www.clive-publishing.com/2009/01/wordpress-27-rss-comments-link-error/ ) for more information and solution.
Regards,
Clive
great! my disk space is smaller now.
So, how about this as the solution to the different URLs – use the rel=canonical command the search engines have just ‘introduced’.
Not sure if this will work, as the content isn’t identical – the comments are different even though the post is the same. What do you think?
http://www.malcolmcoles.co.uk/blog/use-rel-canonical-fix-duplicate-comment-problems-comment-pagination-in-wordpress/
@Malcolm,
I have read up on that new element and as search engines are supposed to treat it the same as a 301 redirect I think it is a great solution. Your code is a good solution and I will update this article with link to you when I will rework this article. Thanks.
Hey Jim, these are all TOP tips for Wordpress, I use most of them myself, great list!
This is a very good post, I’ve boomarked it and will apply tomorrow, I have already stopped revisions, right pain the backside. h2 and h3 button hack will really save me time.
@AskApache,
Thanks! Your web site is great by the way
@simon,
Thanks, nice that you have use of it.
I am very new to Word Press and your article has given me some very valuable insight. There is much I need to do to my new site but most of my concerns are visual. Your post is getting bookmarked for when I solidify my design and move on to more of the functional aspects. Thanks!
I downloaded your quicktags.js and uploaded it, and nothing changed in the editor. I am using WP 2.7.1, WYSIWYG editor (rich editor is turned off). I don’t think any of my plugins are interfering. I did upload it to the correct folder. Any ideas?
@JP,
I forgot to mention that this is not for the WYSIWYG editor. It is for the other one.
thank you I have to download the plugin quicktags.
BTW article in this blog is really interesting to read in
Hey Jim, these are all TOP tips for Wordpress, I use most of them myself, great list!
Wow, good post. The duplicate content story isn’t new with wp, the archive links and the categories also create duplicate content, better not to use them.
I like the one click plugin uploader the most with wp 2.7!
May i copy this article for my clipping book, that’s really usefull for me.
Not if you use summaries such as I do.
No, you may not.
Hi Jim
Thanks for your wonderful post. I’ve been reading and picking up some of your tips on SEO for WP. You’re just great.
And thanks for the quicktags.
Hi Jim,
Is the “problem with duplicated URLs with comment paging” still an issue with the latest WP (2.9.2)?
Tack för bra info!
Hi Jim,
Thanks for the wonderful article, I find all the articles but not found my problem. My problem is unique, I had 4 subblogs on main domain priceindia.net like
priceindia.net/laptop/post-name/,
priceindia.net/mobile/post-name/……After gaining visitors, i merged it to main blog. Now I choose permalink /%category%/%postname%/
priceindia.net/laptop/nokia/post-name/ then i have deleted all sub blogs.
Now webmaster tool shows duplicate content.
I searched whole google, but nothing found. Please help.
What i do?
It’s so good, so many excellent tricks for Wordpress!
Thanks a lot for your tips. But I have a question here that Is it same for wp 3.0? as I am using 3.0 version for most of my wp blogs