Jim Westergren
A blog about me, my projects, SEO, Web Development and Personal Development.
"If we did all the things we are capable of, we would literally astound ourselves." - Thomas A. Edison

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:

  1. It can affect your ranking in search engines. Google is complaining via the Google Webmaster tools.
  2. People can get confused and link to the wrong URL when linking to your blog.
  3. 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)

Settings for comment pages

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:


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.

New quicktags

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.


My other articles about Wordpress


More on this topic


Please comment to improve this article.

Tweet this! Boomark This! Subscribe to the RSS feed
About the Author Jim Westergren 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 taking photos. Read his full about page or contact him. Follow Jim on Twitter or subscribe to this blog.
In Swedish: presentation, blog.
41 responses »Leave a comment
  1. Jim Westergren
    said on January 12, 2009 at 8:42 pm

    Sorry to those who tried to comment and received an error.

    The comments are now working again.

  2. Donace
    said on January 17, 2009 at 12:47 am

    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.

  3. malcolm coles
    said on January 17, 2009 at 1:30 am

    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.

  4. Jim Westergren
    said on January 17, 2009 at 1:52 am

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

  5. malcolm coles
    said on January 17, 2009 at 12:04 pm

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

  6. malcolm coles
    said on January 17, 2009 at 12:05 pm

    Oops. That’s the wrong link! The solution is here, sorry:
    http://www.malcolmcoles.co.uk/blog/avoid-duplicate-content-paged-comments-wordpress-27/

  7. Jim Westergren
    said on January 17, 2009 at 5:44 pm

    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?

  8. malcolm coles
    said on January 18, 2009 at 12:03 pm

    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.

  9. malcolm coles
    said on January 18, 2009 at 12:04 pm

    PS Although this won’t, admittedly, solve the problem of which URL people link to …

  10. Addaxsoft
    said on January 22, 2009 at 11:49 pm

    very nice post .. i liked it .. thnx!

  11. marhgil
    said on January 24, 2009 at 6:01 am

    I only found out about that duplicate content issue here. Thanks for the solution. My blog was “infected,” now, it’s cured. :D

  12. Eligio
    said on January 24, 2009 at 12:38 pm

    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. :D

  13. ismail
    said on January 30, 2009 at 12:32 am

    im using 2.6 is it problem for this?

  14. Jim Westergren
    said on January 30, 2009 at 6:35 pm

    @ismail, What are you referring to? The duplicate content issue? No.

  15. Rudi
    said on February 3, 2009 at 8:57 am

    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

  16. Jim Westergren
    said on February 3, 2009 at 9:16 pm

    @Rudi,

    You do that in the admin under Settings -> Discussion.

  17. Clive
    said on February 4, 2009 at 12:20 pm

    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

  18. izandi
    said on February 6, 2009 at 1:13 pm

    great! my disk space is smaller now.

  19. malcolm coles
    said on February 16, 2009 at 12:52 am

    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/

  20. Jim Westergren
    said on February 17, 2009 at 12:42 am

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

  21. AskApache
    said on February 17, 2009 at 11:17 am

    Hey Jim, these are all TOP tips for Wordpress, I use most of them myself, great list!

  22. simon
    said on February 18, 2009 at 1:59 am

    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.

  23. Jim Westergren
    said on February 18, 2009 at 7:14 pm

    @AskApache,
    Thanks! Your web site is great by the way :)

    @simon,
    Thanks, nice that you have use of it.

  24. Jeff
    said on February 28, 2009 at 6:28 am

    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!

  25. JP
    said on March 7, 2009 at 4:22 pm

    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?

  26. Jim Westergren
    said on March 9, 2009 at 2:30 am

    @JP,

    I forgot to mention that this is not for the WYSIWYG editor. It is for the other one.

  27. syafur
    said on March 14, 2009 at 11:13 pm

    thank you I have to download the plugin quicktags.
    BTW article in this blog is really interesting to read in

  28. burun estetigi
    said on April 17, 2009 at 11:21 pm

    Hey Jim, these are all TOP tips for Wordpress, I use most of them myself, great list!

  29. andreas
    said on April 18, 2009 at 2:59 pm

    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!

  30. pututik
    said on May 12, 2009 at 4:16 pm

    May i copy this article for my clipping book, that’s really usefull for me.

  31. Jim Westergren
    said on May 13, 2009 at 4:10 pm

    The duplicate content story isn’t new with wp, the archive links and the categories also create duplicate content, better not to use them.

    Not if you use summaries such as I do.

    May i copy this article for my clipping book, that’s really usefull for me.

    No, you may not.

  32. Tom Low
    said on October 8, 2009 at 3:37 am

    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.

  33. Jonas
    said on March 19, 2010 at 5:43 am

    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!

  34. Pankaj Singla
    said on March 28, 2010 at 4:51 pm

    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?

  35. Boldis Media
    said on June 3, 2010 at 6:04 am

    It’s so good, so many excellent tricks for Wordpress!

  36. Quick Cash Concept
    said on July 23, 2010 at 11:41 am

    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

Leave a Comment

To quote: <blockquote>text to quote</blockquote>

You can use these tags: <a href=""> <blockquote> <code> <em> <strong>


To have a photo of you beside your comments, upload a photo here.

Pingbacks
  1. [...] UPDATE: This article was written in march 2007 and has not been updated since then, although many parts are still relevant. You should see my latest article about Wordpress: Hacks to boost your WordPress 2.7 blog. [...]

    Pingback by SEO for WordPress - The Complete Guide — January 11, 2009 @ 7:43 pm

  2. [...] Då bör du enligt mig ta en titt på min nyskrivna artikel Hacks to boost your WordPress 2.7 blog [...]

    Pingback by Har du en blogg med Wordpress? | Jim Westergren — January 12, 2009 @ 12:16 am

  3. [...] Just posting a screenshot of the new wordpress 2.7 dashboard its pretty amazing: wordpress 2.7 Hacks to boost your WordPress 2.7 blog – jimwestergren.com 01/11/2009 Hacks to boost your WordPress 2.7 blog Posted in WordPress on [...]

    Pingback by Posts about wordpress 2.7 as of January 11, 2009 | Lyrical Biz — January 12, 2009 @ 3:44 am

  4. [...] Jim Westergren points out, WordPress introduce comment pagination in version 2.7. The setting, which is on be default, breaks [...]

    Pingback by Get More Traffic: an SEO Guide for WordPress | WPblogger — June 18, 2009 @ 4:33 pm

  5. [...] post: Hacks to boost your WordPress 2.7 blog Tags: howto, optimization, reference, [...]

    Pingback by wp-popular.com » Blog Archive » Hacks to boost your WordPress 2.7 blog — February 19, 2010 @ 6:09 am

Previous post in category:

Next post in category:

Design by myself:  valid XHTML and valid CSS.