Tweet Button & HashTags... is it possible?


Hello all!

I’ve included a “Share on Twitter” button on my website, and I’m trying to include a small blurb that shows up in the share box by default - the blurb uses HashTags but they don’t seem to be working correctly. This is what I’ve written for the share box:

“Share @MyApp with the world! Coming soon to #iPhone and #Android

When you hit the “Share on Twitter” button, what happens is the blurb only shows “Share @MyApp with the world! Coming soon to” and omits anything after #iPhone and #Android.

Any idea what could be causing this and how to remedy it?

Your help would be greatly appreciate! =)


You probably need to html encode your hash: # instead of #


Ponra - Thanks for your suggestion but I tried the character code for the hashtag and it still didn’t work =(

Any other ideas?


I found an example of CNN using a HashTag on their share button, so it is definitely possible.

Take a look, the twitter share button is near the top right:

When I copy the link address I get:

Notice how there is an & before hashtags=cnn, not sure how that works exactly but I thought i’d share it here just in case it sparks an idea/solution…




Hi Sunny.

There are two parts to this. CNN are using the actual hashtags argument for the Tweet Intent to append hashtags to the text. This is a comma-separated list of tags. So, for example:!&hashtags=foo,bar,baz

That invokes the intent with just the text ‘Hello world!’ highlighted, followed by #foo #bar #baz, followed by the shortened URL.

For your example though, where you want the hashtags embedded in your text, you will need to encode the hashes. Hashes are special characters in the URL (they identify document fragments) so they, and anything following, does not get sent the server.

@Ponra was close with the suggestion to HTML encode the #, but you need to URLEncode it, so use %23. Like this:!+Coming+soon+to+%23iPhone+and+%23Android

Hope that helps,

@benward, Twitter Platform Developer


@BenWard Thank you so much for your answer. That was exactly what I was looking for and I thought it was impossible. I really appreciate your help!! =D


Your example code and the CNN example code work.

Putting the ‘hashtags’ attribute into the tweet share interface or embedding the URLEncode hashtags in the ‘text’ attribute does not work.

So, if you want to share a “Tweet” button with a counter, it appears to not be doable at this time.

Or am I missing something?


Not sure if this is where I would ask this question but, here is in hopes that someone may know the answer. Just recently my website url’s are adding what looks like a hashtag to the end of all of my pages. Looks like this:

Everything from the # and on is not suppose to be there. Any clue as to what it is and where it came from??


Thanks @BenWard it was exactly what I was searching!


The HTML one get from [Twitter buttons] ( ) seems to be wrong:

Tweet #test


Hi @webjay – thanks for pointing out that the configurator is broken in that instance. Asking the team to fix that.


Thank you so much for this!


Hi guys,
I need a bit of help please. Here’s what I am trying to do:

 - Site (Wordpress Based)
 - I am trying to create a Tweet This button and include the post Categories and Tags as Hashtags in the Tweet message ... For example, let say that post X has the tags A1, A2 an A3 and it is in the B1 category. The tweet message should look like: "[Page Title] - [Page URL] - via @[Twitter Username] - #B1 #A1 #A2 #A3.

Does anyone know a way to achieve this? Does anyone know a WP plugin that does this? If I need to hardcode it, how should I go about it - can anyone help with a piece of code?

Thanks in advance.


Hi guys,

Anyone to give a hand to a poor soul who’s parents pushed him to Basketball rather than programming??? :slight_smile:



I have the same problem, I was able to set "[Page Title] - [Page URL] - via @[Twitter Username]* but I can not even enter the hashtag #tag1 #tag2 #tag3



You can use %23 to replace # sign


Thank you @benward! This was very helpful.


@benward, any idea how to do this if the hashtag is in the middle of the text? For example if I wanted the tweet to read 'Hello #world - how are you?'


did you manage to get this done @CoolPileCom? i am trying to build a list of hashtags programmatically and I can use some help :slight_smile: thanks in advance