Skip to content

Share buttons

How to add social share buttons to WordPress

By Hannah Voss, Editor · Reviewed September 2026 · 6 min read

Quick answer

There are three ways to add share buttons to WordPress: a sharing plugin, a block or pattern that outputs plain share links, or a few lines in your child theme. Pick the lightest option that gives you the networks your readers use, place the buttons after the post first, and only add share counts you can keep accurate.

A dark paper panel with four pale rounded paper tiles set into a recessed strip below it, the last tile being slotted in

Three ways to add social share buttons to WordPress

Every share button, however it is styled, does the same thing: it opens a network's share dialog with your page address filled in. What differs is how much code runs on your page before anyone clicks. That is the real decision, because it controls page speed, privacy exposure and how much can break later. The rest of the share buttons section goes deeper on each of those; this guide gets a working row on the page.

ApproachWhat it adds to the pageBest for
Sharing pluginSettings screen, icons, optional counts, sometimes extra scriptsSites that want counts, placement rules and no code
Block or pattern with plain linksA row of links with inline icons, nothing elseBlock themes and speed-focused sites
Child theme template codeLinks printed by PHP in your post templateDevelopers who want full control and zero plugin updates

Option 1: a sharing plugin

  1. Install and activate

    In Plugins, Add New, search for share buttons and read each listing's last updated date and tested version before installing. A plugin that has not been updated for a year is a migration waiting to happen.

  2. Pick networks

    Start with three or four networks your readers actually use. More buttons lower the chance that any one is used; see which share networks to show.

  3. Set placement

    Turn on buttons after the content of posts. Add a top position or a sticky bar only if you have a reason.

  4. Decide on counts

    Leave counts off until you have read how share counts work. A row of zeros is worse than no number.

  5. Check the output

    View a post logged out, on a phone, and run it through a speed test. Confirm the buttons open the right dialog with the right address.

A share link is just a URL. The page address and, where supported, a title go into the query string, URL encoded. You can put these links in a Custom HTML block, a reusable pattern, or your theme. They load nothing from the network until clicked, which makes them the fastest and most private option.

Facebook:  https://www.facebook.com/sharer/sharer.php?u={url}
X:         https://twitter.com/intent/tweet?url={url}&text={title}
LinkedIn:  https://www.linkedin.com/sharing/share-offsite/?url={url}
Pinterest: https://pinterest.com/pin/create/button/?url={url}&media={image}
Email:     mailto:?subject={title}&body={url}

Replace the placeholders with the encoded page address, title and image. In a theme, rawurlencode( get_permalink() ) and rawurlencode( get_the_title() ) give you the values.

A copy link button belongs in the same row, because a large share of sharing happens in private chats where no network button applies. It needs a few lines of script and a visible confirmation:

<button type="button" class="share-copy" data-url="https://example.com/post/">Copy link</button>
<script>
document.querySelector('.share-copy').addEventListener('click', function () {
  var btn = this;
  navigator.clipboard.writeText(btn.dataset.url).then(function () {
    btn.textContent = 'Link copied';
    setTimeout(function () { btn.textContent = 'Copy link'; }, 2000);
  });
});
</script>

Option 3: theme code

If you already maintain a child theme, printing the links from single.php or a template part avoids a plugin entirely. Keep the markup semantic: a nav or ul with a visible label such as "Share this post", links with accessible names like "Share on LinkedIn", and icons marked aria-hidden.

What happens when a reader clicks a share link01Reader clicksyour page02Share URL opensencoded address03Network dialogreader edits text04Post publishedon the network
A share button only opens a dialog. The network scrapes your page's preview tags when the dialog loads.

That last step matters more than the button. Whatever travels with the share, the title, the image and the description, comes from your page's preview tags, and a note written only in the body of the post does not travel with it. If a post needs a disclosure to arrive intact, put it where the scraper reads; see disclosure that survives a share.

Worked example: a recipe blog's share row

Take a recipe blog with about 12,000 sessions a month, most of them on phones. The numbers here are invented but realistic. Its referrer report shows Pinterest and Facebook sending almost all social traffic, so the row is Pinterest, Facebook, email and copy link, in that order, placed after the content only. Share counts stay off because the site has no Facebook app credentials and a row of small numbers would look worse than none.

SettingValue in this exampleReason
NetworksPinterest, Facebook, Email, Copy linkMatches the referrer report
PositionAfter post contentReaders decide to share after reading
CountsOffNo credentials, low numbers
IconsInline SVG, monochromeNo icon font, no network requests
Pinterest imageog:image, 1000 x 1500Pinterest favours tall images
Label"Share this recipe"Visible text beats icons alone

After a month the example blog records about 210 share clicks, roughly 1.7 percent of sessions, with Pinterest and copy link taking three quarters of them. That is enough to justify the row and enough to remove any button that recorded fewer than five clicks. How to record those clicks is covered in tracking share clicks in analytics.

What goes wrong

  • Buttons appear twice. A theme with built-in sharing plus a plugin gives two rows. Turn one off.
  • The wrong address is shared. Buttons placed on archive pages send the archive URL, not the post. Limit output to single post templates.
  • Encoding breaks the link. An ampersand or a question mark in the title, left unencoded, cuts the query string short. Always run values through rawurlencode().
  • Caching hides changes. Settings saved, buttons unchanged: purge the page cache and any CDN before you assume the plugin failed.
  • Every page pays for the assets. Some plugins enqueue their stylesheet and script sitewide, including pages with no buttons. Look for a setting that limits loading to post templates.

Check it worked before you publish

  • Check the link preview each network will show; fix it with Open Graph tags if the image or title is wrong.
  • Test on mobile. Buttons that fit a desktop column often wrap into two ugly rows on a phone.
  • Make sure caching plugins are not serving a stale copy of the buttons after you change settings.
  • If you use shortcodes to place buttons inside content, write down which ones. They become clutter if you ever switch tools; see removing an old share plugin cleanly.
  • Tab through the row with the keyboard: every button gets a visible focus ring and a screen reader announces "Share on" plus the network, not "link".
  • Open each share dialog once, logged out, and confirm the address in it is the post's canonical URL with no tracking parameters you did not intend.

Sources

Questions

Do share buttons help SEO?

Not directly. Shares are not a ranking factor, but shared posts get seen and linked, which can help over time. The bigger SEO effect is negative: heavy share widgets can slow pages.

Where should share buttons go?

At the end of the content first, where a reader who finished the post decides whether it was worth passing on. Add a top position or a sticky bar only after checking it does not push content down.

Can I add share buttons without a plugin?

Yes. Plain share links in a Custom HTML block or your theme work everywhere and load nothing until clicked.

Should I show share counts?

Only if you can keep them accurate and they are high enough to act as social proof. Many networks no longer provide counts at all.

How do I add share buttons to a block theme?

Create a pattern containing a Custom HTML block with the share links, then insert that pattern into the single post template in the Site Editor. It renders on every post with no plugin.

Share this guide

Hannah Voss, Editor. Checks every guide against a working WordPress install and the networks' current documentation. Last reviewed September 2026.

  1. Which share networks to show, and how manyHow to choose which social share buttons to display: match networks to your audience, keep the row short, and add copy link, email and messaging options.6 min read
  2. Share buttons and page speedWhy some share buttons slow WordPress pages and others cost almost nothing. How to measure the impact, and what to change to keep sharing fast on every page.5 min read
  3. How share counts work, and why most networks stoppedHow Facebook and other networks calculate share counts, why X, LinkedIn and others removed them, what a share counter really shows, and how plugins fetch it.6 min read