
How to add social media sharing buttons to WordPress?
The easiest way to add social media sharing buttons to WordPress is to install a sharing plugin such as AddToAny Share Buttons, Jetpack, Grow Social, or Shared Counts, choose your networks, and let the plugin place the buttons above or below your posts. If you want the lightest possible option, you can also create your own share links with a few lines of PHP, since every major network supports simple share URLs that don't require any external scripts.
Sharing buttons make it effortless for readers to pass your content along, which can bring in new visitors without extra effort on your part. This guide explains the difference between sharing and follow buttons, walks through the best plugin options, shows you how to build lightweight buttons with code, and covers placement, performance, and privacy considerations.
Sharing Buttons vs. Follow Buttons
Before you start, it's worth clearing up a common confusion:
- Sharing buttons let visitors share a specific post or page to their own social profiles. Clicking "Share on Facebook" opens a dialog to post your article's link.
- Follow buttons (or social icons) link to your own profiles, like your LinkedIn page or YouTube channel, so visitors can follow you.
WordPress includes a core Social Icons block that creates follow buttons, which is great for a header or footer. It does not create sharing buttons. For sharing, you'll need a plugin or a little custom code.
Why Add Social Sharing Buttons?
Sharing buttons remove friction. Without them, a reader who wants to share your post has to copy the URL, open the app, and paste it. With them, it's one tap. Benefits include:
- More reach: Each share puts your content in front of a new audience.
- Referral traffic: Shared links bring visitors from social platforms and messaging apps.
- Social proof: Share counts, when used, can signal that a post is popular.
- Better content insights: Seeing which posts get shared helps you plan future content.
Keep your expectations realistic, though. Buttons help people who already want to share, but they won't make weak content go viral.
Which Networks Should You Include?
More buttons don't mean more shares. Too many options can overwhelm readers and clutter the design. Pick three to five networks that match your audience:
- Facebook: Still broad and general-purpose.
- X (formerly Twitter): Useful for news, tech, and commentary.
- LinkedIn: Essential for business, B2B, and professional content.
- Pinterest: Strong for visual niches like food, crafts, design, and travel.
- WhatsApp and Telegram: Popular for sharing on mobile, especially in many regions outside the US.
- Reddit: Can work for niche technical or hobby content.
- Email and copy link: Often overlooked, but many people share privately.
Check your analytics to see where your social traffic already comes from, and start there.
Method 1: Add Sharing Buttons With a Plugin
Plugins are the fastest route and handle styling, placement, and icons for you.
Popular Social Sharing Plugins
- AddToAny Share Buttons: Free, flexible, and supports a huge list of networks, plus a universal share button.
- Jetpack: Includes sharing buttons as one of its features, and adds a Sharing Buttons block for the block editor.
- Grow Social by Mediavine: A simple, clean free version with paid upgrades for more networks and features.
- Shared Counts: Lightweight and performance-focused, with optional share counts.
- Social Warfare: Feature-rich with customizable designs and a Pro version.
- Novashare: A premium, performance-focused plugin known for being lightweight.
Setting Up AddToAny as an Example
- Install the plugin: Go to Plugins > Add New Plugin, search for "AddToAny Share Buttons," then install and activate it.
- Open the settings: Navigate to Settings > AddToAny.
- Choose your networks: Under "Share Buttons," click "Add/Remove Services" and pick the networks you want.
- Set the icon style and size: Match the buttons to your site's look.
- Choose placement: Select whether buttons appear at the top or bottom of posts, pages, and other post types.
- Consider floating buttons: Under the "Floating" tab, you can add a vertical bar on desktop or a horizontal bar on mobile.
- Save and check: Save changes and view a post on both desktop and mobile.
Setting Up Jetpack Sharing Buttons
If you already use Jetpack:
- Enable sharing: Go to Jetpack > Settings > Sharing and turn on sharing buttons.
- Add buttons in block themes: Open Appearance > Editor > Templates, edit the single post template, and add the Sharing Buttons block where you want it.
- Choose services: Select networks in the block's toolbar, and adjust style and alignment.
Method 2: Add Lightweight Sharing Buttons With Code
If you care about performance and privacy, you don't need a plugin at all. Each major network offers a share URL you can link to directly. No tracking scripts are loaded until the visitor actually clicks.
Here are the common share URL formats:
- 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&description=TITLE - WhatsApp:
https://wa.me/?text=TITLE%20URL - Reddit:
https://www.reddit.com/submit?url=URL&title=TITLE - Email:
mailto:?subject=TITLE&body=URL
Create the Buttons in PHP
Add this to a small custom plugin or your child theme's functions.php. It outputs a list of share links after single post content:
function sajjad_get_share_links() {
$url = rawurlencode( get_permalink() );
$title = rawurlencode( wp_strip_all_tags( get_the_title() ) );
$image = has_post_thumbnail() ? rawurlencode( get_the_post_thumbnail_url( null, 'large' ) ) : '';
$networks = array(
'facebook' => array(
'label' => 'Facebook',
'url' => "https://www.facebook.com/sharer/sharer.php?u={$url}",
),
'x' => array(
'label' => 'X',
'url' => "https://twitter.com/intent/tweet?url={$url}&text={$title}",
),
'linkedin' => array(
'label' => 'LinkedIn',
'url' => "https://www.linkedin.com/sharing/share-offsite/?url={$url}",
),
'pinterest' => array(
'label' => 'Pinterest',
'url' => "https://pinterest.com/pin/create/button/?url={$url}&media={$image}&description={$title}",
),
'whatsapp' => array(
'label' => 'WhatsApp',
'url' => "https://wa.me/?text={$title}%20{$url}",
),
'email' => array(
'label' => 'Email',
'url' => "mailto:?subject={$title}&body={$url}",
),
);
$output = '<nav class="sajjad-share" aria-label="' . esc_attr__( 'Share this post', 'sajjad' ) . '">';
$output .= '<span class="sajjad-share__label">' . esc_html__( 'Share:', 'sajjad' ) . '</span>';
$output .= '<ul class="sajjad-share__list">';
foreach ( $networks as $key => $network ) {
$is_email = ( 'email' === $key );
$output .= sprintf(
'<li><a class="sajjad-share__link sajjad-share__link--%1$s" href="%2$s"%3$s>%4$s</a></li>',
esc_attr( $key ),
esc_url( $network['url'], $is_email ? array( 'mailto' ) : array( 'https' ) ),
$is_email ? '' : ' target="_blank" rel="noopener noreferrer"',
esc_html( $network['label'] )
);
}
$output .= '</ul></nav>';
return $output;
}
function sajjad_add_share_links_to_content( $content ) {
if ( is_singular( 'post' ) && in_the_loop() && is_main_query() ) {
$content .= sajjad_get_share_links();
}
return $content;
}
add_filter( 'the_content', 'sajjad_add_share_links_to_content' );
If you only want the buttons in specific places, remove the filter and register a shortcode instead:
add_shortcode( 'sajjad_share', 'sajjad_get_share_links' );
You can then add [sajjad_share] with a Shortcode block anywhere, including in a block theme's post template.
Style the Buttons With CSS
Add this to your child theme's stylesheet or Appearance > Editor > Styles > Additional CSS:
.sajjad-share {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
margin: 2rem 0;
}
.sajjad-share__label {
font-weight: 600;
}
.sajjad-share__list {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0;
padding: 0;
list-style: none;
}
.sajjad-share__link {
display: inline-block;
padding: 0.45rem 0.9rem;
border-radius: 4px;
color: #fff;
font-size: 0.9rem;
text-decoration: none;
background: #333;
}
.sajjad-share__link:hover,
.sajjad-share__link:focus {
opacity: 0.85;
}
.sajjad-share__link--facebook { background: #1877f2; }
.sajjad-share__link--x { background: #000; }
.sajjad-share__link--linkedin { background: #0a66c2; }
.sajjad-share__link--pinterest { background: #e60023; }
.sajjad-share__link--whatsapp { background: #128c7e; }
Add a Native Share Button for Mobile
Modern mobile browsers support the Web Share API, which opens the device's own share sheet with every app the visitor has installed. You can add a single "Share" button that uses it, with a fallback that copies the link:
<button type="button" class="sajjad-native-share" hidden>Share</button>
document.addEventListener( 'DOMContentLoaded', () => {
const button = document.querySelector( '.sajjad-native-share' );
if ( ! button ) {
return;
}
button.hidden = false;
button.addEventListener( 'click', async () => {
const shareData = {
title: document.title,
url: window.location.href,
};
if ( navigator.share ) {
try {
await navigator.share( shareData );
} catch ( error ) {
// The user cancelled the share dialog. Nothing to do.
}
} else if ( navigator.clipboard ) {
await navigator.clipboard.writeText( shareData.url );
button.textContent = 'Link copied!';
}
} );
} );
Enqueue the script properly from your theme or plugin rather than pasting it inline:
function sajjad_enqueue_share_script() {
if ( is_singular( 'post' ) ) {
wp_enqueue_script(
'sajjad-share',
get_stylesheet_directory_uri() . '/js/share.js',
array(),
'1.0.0',
array( 'strategy' => 'defer', 'in_footer' => true )
);
}
}
add_action( 'wp_enqueue_scripts', 'sajjad_enqueue_share_script' );
Where to Place Sharing Buttons
Placement affects both how often buttons are used and how they feel to readers:
- Below the post: The most natural spot. Readers who reach the end liked the content enough to finish it.
- Above the post: Visible immediately, but readers haven't yet decided whether the post is worth sharing.
- Floating sidebar on desktop: Stays visible while scrolling, but can feel intrusive on narrow screens.
- Sticky bar on mobile: A slim bar at the bottom of the screen works well on phones, as long as it doesn't cover content or other navigation.
- Inline "click to share" quotes: Highlight a memorable line and let readers share it directly to X or LinkedIn.
- Images: Pinterest "save" buttons that appear on image hover suit visual blogs.
For most blogs, below the post plus an optional mobile sticky bar is a solid, unobtrusive combination.
Should You Show Share Counts?
Share counts can provide social proof, but they come with tradeoffs:
- Low numbers can backfire: A post showing "0 shares" may discourage sharing.
- Many networks no longer provide public counts: X removed its public count API years ago, so plugins can only estimate or omit them.
- API calls add overhead: Fetching counts requires external requests, which plugins usually cache to limit the impact.
Many plugins let you hide counts until they pass a minimum threshold. If you're unsure, leave them off.
Keep Sharing Buttons Fast
Some sharing plugins load heavy JavaScript, fonts, and tracking scripts from third-party servers on every page. To keep things quick:
- Prefer plugins that use static links or inline SVG icons: Shared Counts, Novashare, and custom code are typically very light.
- Avoid official network embed widgets: Scripts like the Facebook SDK add significant weight just to show a button.
- Load assets only where needed: Buttons usually only belong on posts, not on every page.
- Test before and after: Run PageSpeed Insights on a post before and after installing a plugin to see the real impact.
Privacy Considerations
Official embedded share widgets from social networks can set cookies and track visitors even if they never click. Under privacy laws like GDPR, that may require consent. Plain share links, like the ones in the code above, don't load anything from the network until the visitor clicks, which is much more privacy-friendly. If you use a plugin, check whether it loads third-party scripts on page load, and review your cookie consent setup if it does.
Make Your Shared Posts Look Good
When someone shares your post, the social platform builds a preview card using Open Graph and similar meta tags. Without them, the preview may show the wrong image or a truncated title. SEO plugins such as Yoast SEO, Rank Math, and All in One SEO add these tags automatically and let you set a custom social title, description, and image for each post.
Choose featured images that work well at common social preview sizes (a wide, roughly 1.91:1 image is a safe default) and keep important text away from the edges, where it may be cropped. You can test previews with each platform's debugging tools, such as Facebook's Sharing Debugger and LinkedIn's Post Inspector.
Make Your Buttons Accessible
Sharing buttons should be usable by everyone:
- Use descriptive labels: Icon-only buttons need an accessible name, such as
aria-label="Share on LinkedIn"or visually hidden text. - Ensure keyboard access: Buttons should be reachable and usable with the Tab and Enter keys.
- Check color contrast: Text and icons must stand out clearly against the button background.
- Warn about new windows: Consider noting that links open in a new tab, or letting them open in the same tab.
FAQ: Social Sharing Buttons in WordPress
No. WordPress includes a Social Icons block for linking to your own profiles, but not sharing buttons. You need a plugin like AddToAny or Jetpack, or custom share links.
They can, if the plugin loads heavy third-party scripts on every page. Lightweight plugins and plain share links have almost no impact on page speed.
Below the post content is a reliable default, since readers who finish an article are most likely to share it. A slim sticky bar on mobile can also work well.
Three to five is usually enough. Choose the networks your audience actually uses, which you can check in your analytics referral data.
Social platforms use Open Graph tags to build previews. Set a social image in your SEO plugin, then refresh the cached preview with the platform's debugging tool.
Not directly. Shares aren't a direct ranking factor, but they can bring traffic and visibility that lead to links and mentions, which do help over time.
Conclusion
Adding social media sharing buttons to WordPress is quick with a plugin like AddToAny, Jetpack, or Grow Social, and even lighter with a few custom share links and some CSS. Whichever method you choose, focus on a small set of networks your audience actually uses, place the buttons where readers naturally want to share, and make sure your posts produce attractive preview cards.
Keep an eye on performance and privacy as you go. Buttons that load heavy tracking scripts can cost you more in speed than they return in shares, while simple, well-placed links give readers an easy way to spread your content without slowing anyone down.


