How to Add X (Twitter) Share Buttons and Click-to-Tweet Boxes in WordPress

October 24, 2014
Updated
How to Add X (Twitter) Share Buttons and Click-to-Tweet Boxes in WordPress

Share buttons and "click to tweet" boxes are still one of the easiest ways to get readers to spread your posts on X (formerly Twitter). What has changed is the tooling: some old plugins have closed, X no longer shows share counts, and the share link now lives at x.com. This guide shows the options that work today, from a plain link with no plugin to the most popular share-button plugins.

Option 1: A share link with no plugin

X's official share link is a "web intent". It opens X with a ready-made post that the reader can edit and send. It does not need an X developer app or any API keys, and it works for logged-out readers too (X asks them to sign in first).

The link looks like this:

https://x.com/intent/tweet?text=Your%20text&url=https://yoursite.com/post&via=yourname

The parameters you can use:

  • text: the pre-filled text of the post.
  • url: the link to your article. X shows it as a link card.
  • via: your X username, so the post credits you.
  • hashtags: comma-separated hashtags, without the # sign.
  • related: accounts X may suggest following after the reader posts.

Spaces and special characters in the text must be URL-encoded (a space becomes %20). Keep the text, link and username together within X's 280-character limit.

To add it to a post, select some text in the WordPress editor, click the link button and paste the share URL. You can also put it in a Button block for a clear "Share on X" button.

Option 2: X's official Post and Follow buttons

X still offers an official Post (share) button and a Follow button for websites. Both load a small script from X that turns a normal link into a styled button.

  • Post button: a link with the class twitter-share-button pointing to https://x.com/intent/tweet, plus X's widgets script. It accepts the same text, url, via and hashtags options as the share link.
  • Follow button: a link to your profile with the follow button class, plus the same script. Readers can follow you without leaving your site.

You can generate the code at publish.x.com and paste it into a Custom HTML block or widget. The trade-off is that X's script loads on every page that shows the button. If page speed matters, a plain link (option 1) or a plugin that uses simple links is lighter.

Option 3: A share-button plugin

If you want share buttons on every post automatically, a plugin is the easiest route. These are maintained and include X.

AddToAny Share Buttons

AddToAny is one of the most popular sharing plugins, with over 300,000 active installs. It supports X along with Bluesky, Threads, Mastodon, Facebook and many more services, and it also offers follow buttons that link to your own profiles. You choose which buttons appear and where (above or below posts, or floating).

AddToAny on wordpress.org

Simple Social Buttons

Simple Social Buttons is a lightweight plugin with over 20,000 active installs. It includes X (Twitter), Facebook, WhatsApp, LinkedIn, Pinterest and more, with several button styles and placements.

Simple Social Buttons on wordpress.org

Avoid plugins that are no longer maintained. For example, Shared Counts, once a popular choice, was closed on wordpress.org in September 2024.

Option 4: Click-to-tweet boxes

A click-to-tweet box highlights a short, quotable line in your article. When a reader clicks it, X opens with that line and a link back to your post. It works well for key statistics, strong opinions and memorable quotes.

The maintained plugin for this is Better Click To Share, previously called Better Click To Tweet. It adds a block (type /tweet in the editor) and a [bctt] shortcode for the classic editor.

  1. Install and activate Better Click To Share from Plugins > Add New.
  2. Add your X username so shares include "via @username". The plugin counts characters so the quote, your username and the link stay within X's limit.
  3. In a post, add the block and type the line you want readers to share.
  4. Preview the post and click the box to check what the shared text looks like.

Better Click To Share on wordpress.org

You can also build a click-to-tweet box without a plugin: put the quote in a Quote or Pullquote block and link it to a share URL from option 1, with the quote as the text parameter.

Why are there no X share counts?

Older share buttons showed how many times a page had been tweeted. Twitter removed share counts in November 2015, and X has not brought them back. Any plugin that shows an "X shares" number is estimating or counting clicks on its own buttons, not reading a real figure from X.

Tips to get more shares and followers

  • Place buttons where readers finish reading: at the end of the post is usually better than only at the top.
  • Write share text for people, not search engines. One clear line beats a list of hashtags.
  • Add your username with via, so shares lead people back to your profile.
  • Add a Follow button or link in your sidebar, author box or footer.
  • Do not overload the page. Two or three networks your readers actually use are better than fifteen buttons.

FAQ

Is the share link twitter.com or x.com?

X's current documentation uses https://x.com/intent/tweet. Use the x.com address for new buttons and update old twitter.com links when you edit a post.

Do I need an X developer account for share buttons?

No. Share links, the Post button and the Follow button all work without a developer account or API keys.

Which plugin should I use?

AddToAny if you want many networks and follow buttons, Simple Social Buttons for a lighter setup, and Better Click To Share for quote boxes. They can be used together.

Muhammad Dilawar
Muhammad Dilawar
Muhammad Dilawar is a WordPress developer and technical SEO specialist with over 12 years of experience building, optimizing, and maintaining websites. He specializes in WordPress, Elementor Pro, WooCommerce, server optimization, DNS, SSL, Cloudflare, website security, and performance improvements. That work has generated over $500K in revenue for clients and earned him a Top Rated badge on Upwork (top 10% of freelancers) with a 100% client recommendation rate. Through Softstribe, he shares practical guides, tutorials, and industry insights based on real-world experience helping businesses grow their online presence.
More from Muhammad Dilawar →