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.

Boomark This! Subscribe to the RSS feed
About the Author Jim Westergren Jim Westergren is a web entrepreneur from Sweden now living in Bolivia. He is happily married and has two lovely children. Some of his interests are web development, SEO and writing. He is the Founder and CTO of TodaysWeb and his current major project is N.nu. Read his . Follow Jim on Twitter or Google+.
  • Pingback: SEO for WordPress - The Complete Guide

  • Pingback: Har du en blogg med Wordpress? | Jim Westergren

  • Pingback: Posts about wordpress 2.7 as of January 11, 2009 | Lyrical Biz

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

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

    The comments are now working again.

  • http://thenexus.tk/sitemap/ Donace

    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.

  • http://www.malcolmcoles.co.uk/blog/wordpress-comment-pagination-and-duplicate-content/ malcolm coles

    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.

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

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

  • http://www.malcolmcoles.co.uk/blog/wordpress-comment-pagination-and-duplicate-content/ malcolm coles

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

  • http://www.malcolmcoles.co.uk/blog/wordpress-comment-pagination-and-duplicate-content/ malcolm coles

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

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

    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?

  • http://www.malcolmcoles.co.uk/blog/wordpress-comment-pagination-and-duplicate-content/ malcolm coles

    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.

  • http://www.malcolmcoles.co.uk/blog/wordpress-comment-pagination-and-duplicate-content/ malcolm coles

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

  • http://Addaxsoft.com Addaxsoft

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

  • http://www.macuha.com/ marhgil

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

  • http://www.eligio.org Eligio

    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

  • http://www.bybilgi.com ismail

    im using 2.6 is it problem for this?

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

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

  • http://www.klinik-pajak.com Rudi

    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

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

    @Rudi,

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

  • http://www.clive-publishing.com/ Clive

    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

  • http://www.izandi.com izandi

    great! my disk space is smaller now.

  • http://www.malcolmcoles.co.uk malcolm coles

    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/

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

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

  • http://www.askapache.com/ AskApache

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

  • http://www.shop-bright.com simon

    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.

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

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

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

  • http://uidblog.com Jeff

    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!

  • http://www.codeforexcelandoutlook.com/blog/ JP

    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?

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

    @JP,

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

  • http://newreil.com syafur

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

  • http://www.burun-estetigi.info burun estetigi

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

  • http://www.spielbankendeutschland.com andreas

    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!

  • http://pututik.com pututik

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

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

    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.

  • Pingback: Get More Traffic: an SEO Guide for WordPress | WPblogger

  • http://www.clicks-to-success.com/about-us/ Tom Low

    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.

  • Pingback: wp-popular.com » Blog Archive » Hacks to boost your WordPress 2.7 blog

  • Jonas

    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!

  • http://www.priceindia.net Pankaj Singla

    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?

  • http://boldis.ru Boldis Media

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

  • http://quickcashconcept.org Quick Cash Concept

    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

  • http://www.rohitclub.com/ Rohit Club

    thanks 4 gr8 info..

  • http://www.techkol.com techkol

    i think www subdomain is seo friendly for wp and we should use html suffix to post parmalinks…

  • http://thepriceindia.com/ Sourav @ Price India

    I think the issue is not yet solved, because i am also getting some crawling error in webmaster tools, duplicating urls are very complex to solve..

  • http://www.asktechtz.com Aaron

    Thanks,Nice post,Very helpful.

  • http://zona-indonesia.net Zona Indonesia

    What which can be done by robots due to duplicate content optimation… Peace and thanks.. :)

  • http://www.priceportal.in Prathimesh

    Thanks for your tips. I liked the site very much

  • http://www.priceportal.in Prathimesh

    Please post more information like this.

    Prathimesh
    Price Portal of India

  • http://www.laptop-adapters.org/ gaga

    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.

  • http://www.bakwaash.com/ Raj

    tracebacks was one of the good features in old wordpress, no idea why that has been removed in newer versions of wordpress

  • http://www.shoppaholicalt.com shoppaholicalt.com

    is it blackhat or greyhat SEO?

  • Alan

    Hi Jim,

    I know this is an old post but hopefully you are still monitoring…

    Just need to be sure about something…in the most recent version of WP, if comment pagination is turned off by unchecking break comments into pages, all former “comment-page-1, comment-page-2, etc, will in fact 301 to the canonical, correct?

    From what I can tell, this is the case, just looking for additional confirmation or information. Thanks!

  • Pingback: SEO for WordPress – The Complete Guide | Media Developer

Previous post in category:

Next post in category:

Design, text and custom cache solution by myself.

Page generated in
0.00377 sec