Tweet Button Showing Zero Count

Hey there! I'm currently working on a CLI tool to deploy WordPress apps to DigitalOcean. Check it out! It's free and open source.

I came across this issue a few days ago and started looking for solutions. Didn’t find too many decent ones, which is why I’m writing this post.

I’ve implemented Twitter’s Tweet Button on last week and noticed that it always shows 0 count, despiting the fact that the page has been tweeted 3-4 times. My friends suggested to wait a while, but that didn’t help either. Count was still showing zero after 3 days, so I decided to inspect of what’s going on.

It turns out that Twitter has it’s own monster crawler called Twitterbot who sends HTTP HEAD requests to pages that have been tweeted. This flooded my error log with code 405 responses: Method not allowed. I thought that this is the part that was causing the 0 count and I was right. I solved it with only a couple of lines in my Python code, inside the WSGI handler (note that I’m running Google App Engine):

def head(self, screen_name):

That was quite easy ;) Too bad the Twitter developers docs don’t mention this at all, and a Google search for Twitterbot shows you how to create your own Twitter robot ;) Thanks for sharing this, cheers!

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.