
Why share buttons used short links
Before networks shortened links automatically, long addresses ate into character limits and looked messy in posts. Share plugins added short link integrations, such as the MashShare ShortURLs add-on, which called the Bitly API with the site owner's token and stored the result. The documentation article on getting a Bitly access token was the most linked page on this domain's old knowledge base, so this guide covers the same task as it works now.
Get the Bitly access token
Sign in
Log in to your Bitly account in a browser.
Open settings
Go to your account or profile settings. The token lives in a section named for the API or developer settings; the exact label has changed over the years.
Generate a token
Choose to generate an access token and confirm your password. Copy the token straight away; treat it like a password.
Paste it into your plugin
Open your sharing or short link plugin settings, paste the token in the Bitly field, and save.
Clear caches and test
Purge page caches, share a test post, and check that the link in the share dialog is the short version.
Worked example: what the plugin does with the token
Behind the settings field, a plugin makes one request per post to the shortening endpoint documented in the Bitly API reference, sending the long URL and the token as a bearer credential, and stores the returned short link in post meta. Testing the token yourself with the same call is the quickest way to tell a plugin problem from an account problem.
curl -X POST https://api-ssl.bitly.com/v4/shorten \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"long_url": "https://example.com/2026/share-links/"}'
# a working token returns JSON containing "link": "https://bit.ly/..."
# 403 FORBIDDEN means the token is wrong or revoked; 429 means the plan's rate limit was hitThe numbers below are invented but the ratio is the point. A site with 340 published posts and 12,000 page views a month needs 340 calls in total if the plugin stores each short link, plus one per new post. A plugin that shortens on every page view instead makes 12,000 calls a month, hits rate limits, and slows every uncached load while it waits for the API.
| Plugin behaviour | API calls per month | Effect on page load | Verdict |
|---|---|---|---|
| Shorten once, store in post meta | 340 plus new posts | None after the first request | Correct |
| Shorten on publish only | About 20 (new posts) | None | Correct, if old posts are back-filled |
| Shorten on every uncached page build | Hundreds to thousands | Adds an API round trip per cache miss | Replace the plugin |
| Shorten in the browser on click | One per share click | None on load, delay on click | Exposes the token; avoid |
When short links fail
| Symptom | Likely cause | Fix |
|---|---|---|
| Long link still used | Token missing or pasted with a space | Paste again, save, clear caches |
| Works for old posts, not new | Monthly link quota reached on the plan | Check the plan's limits in the account |
| Errors after months of working | Token revoked or account password reset | Generate a new token |
| Slow pages | Plugin calls the API on page load | Use a plugin that stores links per post |
Do you still need short links?
Probably not for sharing. X wraps every link and counts it as 23 characters regardless of length. Facebook and LinkedIn show a preview card, not the raw address. Short links still help when you want click statistics per campaign or a branded domain, but that is a marketing choice, not something share buttons require.
What goes wrong
- Token in the wrong field. Some plugins have separate fields for a legacy login and API key pair and for the newer access token. Only the token field works with the current API.
- Token pasted into a public place. A token in a theme file, a page's HTML or a browser script lets anyone shorten links on your account. Keep it in the plugin's settings, which are stored in the database.
- Cache serving the long link. The token works, the short link is stored, and the page still shows the long one because the cached HTML predates it. Purge after saving.
- Short links pointing at staging. Links created while the site ran on a staging domain keep pointing there. Regenerate them after a domain move.
- Tracking parameters baked in. If the plugin appends campaign parameters before shortening, every short link carries them for ever. Decide the parameters first; see tracking shares in analytics.
Check it worked
- The test request above returns a link, not a 403.
- A newly published post shows a short link in the share dialog after one page load.
- Reloading the post ten times makes no further API call, visible in the plugin's log or a query monitor.
- The short link resolves to the canonical post URL, on the live domain, with only the parameters you intended.
- The token appears nowhere in the page source.
If the goal was shorter posts on X, click to tweet boxes explain why every link already counts as 23 characters. The row the short link ends up in is set up in adding share buttons to WordPress, and other integrations are indexed on the share buttons hub.
Sources
Questions
Where do I find my Bitly access token?
In your Bitly account settings, under the API or developer section. Generate a token and confirm your password.
Why are my share buttons not using Bitly links?
Usually the token is missing, has a stray space, was revoked, or your plan's monthly limit was reached. Caches can also serve the old link.
Do I need short links for X?
No. X counts every link as 23 characters, whatever its length.
How do I test whether my Bitly token works?
Send one shorten request to the API with the token as a bearer credential, as in the example above. A link in the response means the token is fine and the problem is in the plugin or cache.
Is it safe to put a Bitly token in a plugin?
Yes, if the plugin stores it in the database and uses it only on the server. Never place the token in theme files or browser scripts, where anyone can read it.
Hannah Voss, Editor. Checks every guide against a working WordPress install and the networks' current documentation. Last reviewed September 2026.
Related reading
- How to add social share buttons to WordPressAdd social share buttons to WordPress with a plugin, a block, or plain links in your theme. Placement, networks, counts and the checks to run afterwards.6 min read
- Click to tweet boxes: how to build them in WordPressBuild a click to tweet box in WordPress with a block or a simple link. Wording, the 280 character limit, how links are counted, and how to style the quote.5 min read
- Tracking shares and pageviews in analyticsTrack share button clicks as analytics events, tag shared links with campaign parameters, and read shared traffic in referrer reports without cookies.5 min read