WordPress Logo – Athemeart WordPress Themes

8 WordPress Social Share Plugins with Share Counts Code

Nobody shares a post because a button exists. They share it because the button was sitting right there at the exact moment they decided the post was worth passing on. A good WordPress social share plugin removes every bit of friction from that moment. A bad one slows the page down, shows a lonely “0” counter, or hides the buttons under a cookie banner.

This guide compares eight WordPress social share plugins, from CodeCanyon heavyweights to free options on WordPress.org, and it fills the gaps most roundups leave open: how shared counts in a WordPress plugin really work in 2026, what happens to counters behind page caching, and copy-and-paste code to add social share buttons in WordPress without a plugin, including an AJAX share counter you can drop into a child theme.

fXin1.2Kshares
Share buttons, network links and a share counter: the three parts every social sharing setup needs.

Quick picks: which plugin fits which job

  • Most complete suite: Easy Social Share Buttons (items 2 and 8 below).
  • Best for lead magnets: Social Share & Locker Pro, thanks to its share-to-unlock module.
  • Best for posting to your own social accounts: FS Poster.
  • Best free starting point: Ultimate Social Media Icons or the free tier of WPZOOM Connect.
  • Best for sticky contact and share menus: Floating Button.
  • Best lightweight shortcode option: Social Share Buttons by Elfsight.

Two kinds of “social” plugin (and why it matters)

Search results for wordpress share to social media plugin mix two very different tools, and picking the wrong one wastes money.

  • Share buttons let your readers push a post to their own networks. Most plugins in this list belong here.
  • Auto-posters and schedulers push your posts to your own accounts when you hit Publish. FS Poster is the one example below.
  • Follow icons link to your profiles. Several plugins bundle them next to the share buttons, which is handy when you want to point visitors at a channel such as Instagram. If that is on your list, our guide to Instagram plugins for WordPress covers the feed side.
  • Counters show how often something was shared. They are a feature of the first group, and they are the trickiest part to get right, which is why they get their own section further down.

Choosing networks is a separate decision. Match the buttons to where your audience actually spends time. Our overview of the most popular social media sites is a useful starting point, and your own analytics will tell you which of those really send traffic.

What to check before you install a social share plugin

Every plugin below looks good on its sales page. These are the checks that separate a plugin you will keep from one you will uninstall in a month:

  • Networks you need. Facebook, X, LinkedIn and Pinterest are table stakes. WhatsApp, Telegram and email matter for mobile readers, and some plugins now add buttons that send a post to AI assistants.
  • Weight on the page. Plain links and inline SVG icons cost almost nothing. Icon fonts, external scripts and live counter calls cost more.
  • How counts are produced. Real network counts, counted clicks on your own buttons, or no counts at all? The difference changes what the number means.
  • Page caching. A counter that is printed into the HTML goes stale on a cached page. Good plugins refresh numbers with a small request after load.
  • Privacy. Check whether the plugin sets cookies, stores IP addresses, or loads files from other domains before a click. Your privacy policy should match the answer.
  • Editor and builder support. Shortcodes, Gutenberg blocks, Elementor widgets or WPBakery modules decide how easily you can place the buttons where you want them.
  • Store features. WooCommerce stores should look for product-page sharing and the option to show the buttons after checkout.
  • Licence, updates and support. CodeCanyon licences usually include six months of support. Check the “last update” date, because a plugin untouched for years deserves a staging-site test first.

One rule of thumb saves a lot of trouble: run one share plugin at a time. Two plugins printing buttons on the same page duplicate markup, fight over styles and double your requests.

Quick comparison table

Prices and sales figures are taken from each vendor’s own listing in November 2026 and change often, so confirm them before you buy.

Plugin Type Price as listed Best for
Social Share & Locker Pro Share buttons plus content locker $20 regular licence (CodeCanyon) Lead magnets, WPBakery sites
Easy Social Share Buttons for WordPress All-in-one social suite $59 regular, $299 extended (CodeCanyon) Publishers and stores that want everything
FS Poster Auto-poster and scheduler $229 regular licence (CodeCanyon) Posting to many accounts
Social Share Buttons by Elfsight Shortcode share buttons See the CodeCanyon listing Quick, simple setups
Floating Button Sticky action buttons Free Lite, Pro on CodeCanyon Floating share and contact menus
WPZOOM Connect Icons, share buttons, chat Free, Pro from $39 a year Block Editor users
Ultimate Social Media Icons Icons, share buttons, counts Free, premium upgrade available Beginners on a budget
Social Sharing Plugin by AppsCreo Same suite as item 2, sold direct 30-day trial, then annual or lifetime Buyers who prefer direct licensing

Social Share & Locker Pro

Unlocked
Visitors share first, then the locked content opens.

Social Share & Locker Pro by azzaroco is two tools in one: a classic share-button plugin and a “pay with a share” content locker. The share side covers dozens of networks, including Facebook, X, LinkedIn, Pinterest, WhatsApp, Telegram and Reddit, with an email-sharing popup for people who would rather not post publicly. On CodeCanyon it sells for $20 on a regular licence and has passed 4,800 sales with a 4.23 out of 5 rating from 183 reviews.

Key features

  • Ten ready-made, retina-friendly button themes, with or without the full network name.
  • Three display modes: a floating “website display”, a “content display” above or below posts, and a shortcode generator for custom spots.
  • Social Locker: hide a download button, paragraph, video or gallery until the visitor shares. You can add a delay, auto-unlock after a while, or reset the lock after a set time.
  • Smart targeting for the locker by login status, past commenters, user role, referrer (for example, only visitors from Google) and device.
  • Share counts pulled from the networks, an offline counts workflow and a minimum-shares condition, so a fresh post does not advertise a tiny number.
  • Compatibility with WooCommerce, JigoShop and BuddyPress, plus dedicated WPBakery Page Builder modules.

Best for

Marketers who give away templates, ebooks or checklists and want a share to be the “price”. It also suits sites already built on WPBakery, where the locker can wrap any row.

Worth knowing

The listing shows its last update in October 2022 and compatibility up to WordPress 6.6, and it is not marked as Gutenberg-optimized. Test it on a staging copy of your site first. Use the locker sparingly too: gating ordinary articles tends to annoy readers, while gating a real download feels fair.

Check It Now ( Share Locker Pro )

Easy Social Share Buttons for WordPress

Share 1.2KPost 860Chat 410Pin 275
Buttons, counters and analytics in one plugin.

Easy Social Share Buttons by AppsCreo (listed as appscreo on CodeCanyon) is the heavyweight of this list. It has more than 33,600 sales, a 4.68 rating from roughly 1,400 reviews, and a listing that shows version 11.6.1 from September 2026 with WordPress 7.0 compatibility. A regular licence costs $59 and an extended licence $299, and six months of support are included.

Key features

  • Share buttons for more than 50 networks on the CodeCanyon listing, 55 ready templates and a custom template builder.
  • Over 30 automatic display methods, including floating bars, popups, fly-ins, post bars, a WooCommerce share bar and “on media” sharing for images.
  • Two counter modes: real-time counters or cached counters that refresh on a schedule, plus share-count recovery when you change domain or URL structure, and control over when numbers appear.
  • Triggered popups and fly-ins: timed delay, end of post, after a comment, scroll percentage, after a WooCommerce purchase and exit intent.
  • After-share events that ask for a follow, an email signup or another action once someone shares.
  • Analytics with device, position and network reports, A/B split testing and Google Analytics events.
  • Extras: subscribe forms with popular email services, a followers counter, Love This button, Instagram feed, social proof (FOMO) notifications and click-to-tweet quotes.
  • Elementor widgets, Gutenberg blocks, ten shortcodes, WPML and Polylang support.

Best for

Publishers and WooCommerce stores that want one plugin to cover sharing, counters, subscribe forms and analytics. The FOMO notifications pair well with a store-wide social proof strategy, and our roundup of WooCommerce sales notification plugins shows what else is available if you want live purchase popups.

Worth knowing

A plugin this large has a lot of settings. Use the setup wizard, switch on only the modules you need and test the page speed before and after. The developer’s own site also sells the same plugin directly, which we cover as item 8 so you can compare the two buying routes.

Check It Now ( Easy Social Share )

FS Poster

Publish once in WordPress, post everywhere on a schedule.

FS Poster by fs-code answers a different question. Instead of putting buttons in front of readers, it sends your WordPress posts, pages and products to your own social accounts automatically. It costs $229 on a regular licence, has about 17,000 sales and a 4.91 out of 5 rating from 657 reviews, and the listing was updated in June 2026.

Key features

  • Auto-posting to 21 networks and services, including Facebook (profiles, pages, groups), Instagram, X, Threads, TikTok, LinkedIn, Pinterest, YouTube community, Reddit, Tumblr, Telegram, Medium, Google Business Profile, Discord, Mastodon and webhooks.
  • A scheduler with calendar view, bulk scheduling and campaigns that can re-share older posts on a repeat.
  • Custom message templates per network, plus hashtags built from your categories and tags.
  • A posting interval, unique post links for repeat shares and category rules that send each post type to the right account.
  • A direct share panel for images, links and custom messages without writing a blog post.
  • Dashboard insights with click counts per network and account, TinyURL, Bitly and self-hosted URL shorteners, proxy support, unlimited accounts and multisite support.

Best for

Agencies, publishers and shops that manage a lot of profiles and are tired of copying links by hand. It is the strongest answer to the “wordpress share to social media plugin” search when what you want is outbound posting.

Worth knowing

FS Poster does not add share buttons or counters for your visitors, so pair it with one of the other plugins here if you need both jobs done. Each network sets its own rules for connected apps, so plan a quick test post after connecting any new account.

Check It Now ( FS Poster )

Social Share Buttons by Elfsight

[shortcode]
Configure, copy the code, paste it where you want the buttons.

The Elfsight plugin, listed on CodeCanyon as “Social Share Buttons for WordPress”, is the lightweight pick. The listing describes a simple flow: set your options, copy the installation code, and paste it into the part of the page where the buttons should appear. It works through a standard WordPress shortcode, so the same code can go into a sidebar widget, a text block or a page.

Key features

  • Share buttons for networks including Facebook, X, Pinterest, Telegram, Tumblr, Viber, Skype, Facebook Messenger, Blogger, Amazon and email, with WhatsApp confirmed by the author in the comments.
  • Colour options for the icons, so the buttons can match your brand.
  • Shortcode placement anywhere shortcodes work, including widgets.
  • Roughly 270 sales on CodeCanyon.

Best for

Small blogs and brochure sites that only need a tidy row of buttons and do not want to learn a large settings panel.

Worth knowing

This is the oldest listing in the roundup. The changelog shows version 1.0.1 from 2017 and the compatibility list stops at WordPress 5.7, so test carefully on a current install before you buy. The listing also does not document share counters, which is a reason to look at other items if counts matter to you. Check the current price on the listing, because it was not stated in the details we reviewed.

Check It Now ( Social Share by Elfsight )

Floating Button

Share
Floating round buttons stay in view while visitors scroll.

Floating Button by Wow-Company builds sticky floating action buttons. It is not a share plugin in the strict sense, but it solves a common need: a small menu that stays on screen and holds a share link, a contact option and a call button. A free Lite version is available on WordPress.org, and the Pro edition is sold on CodeCanyon.

Key features

  • Button shapes including circle, rounded square, ellipse and square, with colour and hover settings for each button.
  • Button types for links, email and phone, plus login, logout, register and lost-password links.
  • Tooltips, shortcode support, visibility controls for mobile and desktop, and export and import of your menus.
  • More than 2,000 Font Awesome icons.
  • In Pro: unlimited buttons, a built-in social panel, a user menu and a print button.

Best for

Sites that want a floating share-and-contact stack in one corner. Point the link buttons at the share URLs from the code section further down and you get a floating share bar without a full social suite.

Worth knowing

There are no network counters here, and no automatic share links, so you supply each URL yourself. Compare what the free version offers with the Pro features you actually need before you pay.

Check It Now ( Floating Button )

WPZOOM Connect

2,400+ inline SVG icons
Icons, share buttons and a chat button in one plugin.

WPZOOM Connect, formerly known as Social Icons Widget, bundles three modules: social profile icons, share buttons and a chat button. WPZOOM reports use on more than 90,000 websites and a 4.9 out of 5 rating on WordPress.org. The free version is on WordPress.org, and the latest version listed on its product page is 2.1.0 from February 2026.

Key features

  • Free: 2,400+ icons in five sets drawn as inline SVG, share buttons for 12 networks plus email, copy link and print, seven button styles and automatic display on the post types you choose.
  • Block, widget, shortcode and Elementor placement.
  • Pro: a floating share bar, share counts and a Like button, a share analytics dashboard, a Pinterest Save button on images, custom SVG icons and icons inside menus.
  • AI share buttons (Pro): buttons that send a post to ChatGPT, Claude or Perplexity so a reader can ask questions about it.
  • Chat: a floating button for WhatsApp, Telegram, Messenger and Viber, plus an optional AI chat that runs on a separate service with its own free plan.

Pricing and counts

Pro plans are billed yearly: Starter at $39 for one site, Professional at $59 for three sites and Business at $79 for ten, with a 14-day money-back guarantee. Pro counts the clicks on your share buttons on your own server, without a third-party service. If you also want real Facebook counts, you add your own SharedCount API key in the settings.

Best for

Block Editor sites that want fast, cookie-free share buttons and a modern feature set without a huge settings panel.

Check It Now ( WPZOOM Connect )

Ultimate Social Media Icons

12.4K
Simple icons with optional counts, set up in a guided wizard.

Ultimate Social Media Icons, from UltimatelySocial, is one of the long-running free options on WordPress.org. WP Hive lists more than 100,000 active installations, over 5,000 ratings and about twelve years in the directory.

Key features

  • Icons for RSS, email, Facebook, X, LinkedIn, Pinterest, Instagram and YouTube, plus a generic “Share” icon that reaches 200+ other platforms, and uploads for your own custom icons.
  • A guided setup: choose icons, define their actions, pick design and animation, add counts, then choose floating or in-post placement.
  • Floating or sticky icons, an email subscribe option, and share and like icons next to each post.
  • Counts on the icons, which need cURL enabled on your server.

Best for

Beginners who want a free plugin with a step-by-step wizard and optional counts.

Worth knowing

The plugin’s own notes point to a premium version for extras such as placing icons on chosen pages, counters tuned to encourage sharing and more networks (a WhatsApp share icon, for example, is a premium feature). Free and premium plugins should not run together, so replace one with the other if you upgrade.

Check It Now ( Ultimate Social Media Icons )

Social Sharing Plugin by AppsCreo (official site)

Share + Chat + Proof30-day free trial
Same plugin as item 2, bought directly from the developer.

This is the official home of Easy Social Share Buttons, so it is the same codebase as item 2 with a different checkout. The developer describes it as a complete social media plugin used by 600,000+ websites since 2012, with a 4.7 out of 5 average rating and more than 1,300 reviews. When we checked, the site offered a 30-day free trial with no payment details, and a list price of $29 a year or $39 lifetime for one site, with a Black Friday discount running.

What the official site adds

  • Share buttons for 90+ networks, now including AI assistants such as ChatGPT, Claude and Mistral, and 30+ display positions with separate mobile and desktop controls.
  • Unlimited custom share buttons, custom profile networks and custom display methods, all created in the settings without code.
  • Privacy-safe analytics for top-shared content, networks and trends, with no third-party cookies.
  • After-share actions, share-count recovery after HTTPS or domain changes, hover Pinterest pins and WooCommerce product sharing that shows which products customers share most.
  • 22 free add-ons, including Shorty (self-hosted short URLs), Proofly (social proof notifications), Social Chat and a native device share button.
  • AI Social Booster, which generates share titles, tweets and Pinterest descriptions using providers such as OpenAI, Gemini, Claude, DeepSeek, Grok and Mistral.
  • Newer standalone products from the same team, such as Social Profile Card Studio for link-in-bio pages and Social Contact buttons.

Best for

Buyers who want the full feature set with a trial first, a lifetime option and a single vendor account. Every plan unlocks all plugin features, and the plans differ by number of sites, support length and whether the premium add-ons are included.

Worth knowing

Pick one route, either CodeCanyon or the official site, and do not buy both. The two use different licence systems, and the developer provides a licence migration page if you ever want to move.

Check It Now ( Social Sharing Plugin by AppsCreo )

Share counts: how they work and which plugins show them

If you search for a shared counts WordPress plugin or a wordpress counter plugin, you will find three different mechanisms hiding behind the same word.

  1. Network counts. The plugin asks a social network, directly or through a third-party service, how many times a URL was shared. Support depends on the network. Several networks stopped offering public counts, and X is a well-known example, so a plugin that promises real counts for every network deserves a closer look.
  2. Counted clicks. The plugin records every click on its own share buttons. This is reliable and private, but it measures intent to share, not completed shares.
  3. Estimated or recovered counts. Some plugins keep a running total and can add old numbers back after a domain or HTTPS change.

Whatever the method, apply the same display rule. A brand-new post with a “0” or a “3” next to its buttons works against you, so hide counts until they reach a respectable number, like the minimum-count setting in the code below.

Plugin How counts work, per its listing Good to know
Social Share & Locker Pro Real counts from the networks, with an offline counts workflow Has a minimum-shares condition; last updated in 2022
Easy Social Share Buttons Real-time or cached counters Share-count recovery after URL changes; control over when counts appear
FS Poster No share counters; click counts on links you publish Dashboard compares networks and accounts by clicks
Social Share Buttons by Elfsight Not documented on the listing Check the demo before you buy
Floating Button No counters Navigation and action buttons
WPZOOM Connect Pro Counts clicks on your own server Optional SharedCount key adds Facebook counts
Ultimate Social Media Icons Counts on icons Needs cURL on the server
Social Sharing Plugin (official) Same as Easy Social Share Buttons Recovery tool for HTTPS and domain moves

How to add social share buttons in WordPress without a plugin

If you only need a handful of buttons, a few lines of code beat another plugin. Share buttons are just links to each network’s share URL, so they add no scripts, no cookies and almost no weight. The snippet below builds the links for your current post, adds UTM tags so you can see each network in analytics, and prints them under every single post. It also registers an [athemeart_share] shortcode for placing the buttons anywhere else.

Put the code in a child theme or a snippets plugin so a theme update cannot erase it. Our guide to creating a child theme in WordPress walks through the child theme route, and code snippets for WordPress covers the snippets-plugin route.

Step 1: the PHP

/**
 * Social share buttons without a plugin.
 * Paste into your child theme's functions.php or a code snippets plugin.
 */

// 1) Build the share links for a post.
function athemeart_get_share_links( $post_id = 0 ) {
	$post_id   = $post_id ? (int) $post_id : get_the_ID();
	$permalink = get_permalink( $post_id );
	$title     = rawurlencode( wp_strip_all_tags( get_the_title( $post_id ) ) );
	$image     = rawurlencode( (string) get_the_post_thumbnail_url( $post_id, 'large' ) );

	// Tag every network with UTM parameters so analytics can tell them apart.
	$url = function ( $network ) use ( $permalink ) {
		return rawurlencode(
			add_query_arg(
				array(
					'utm_source'   => $network,
					'utm_medium'   => 'social',
					'utm_campaign' => 'share_button',
				),
				$permalink
			)
		);
	};

	return array(
		'facebook'  => array( 'label' => 'Facebook',  'url' => 'https://www.facebook.com/sharer/sharer.php?u=' . $url( 'facebook' ) ),
		'x'         => array( 'label' => 'X',         'url' => 'https://x.com/intent/post?url=' . $url( 'x' ) . '&text=' . $title ),
		'linkedin'  => array( 'label' => 'LinkedIn',  'url' => 'https://www.linkedin.com/sharing/share-offsite/?url=' . $url( 'linkedin' ) ),
		'pinterest' => array( 'label' => 'Pinterest', 'url' => 'https://pinterest.com/pin/create/button/?url=' . $url( 'pinterest' ) . '&media=' . $image . '&description=' . $title ),
		'whatsapp'  => array( 'label' => 'WhatsApp',  'url' => 'https://api.whatsapp.com/send?text=' . $title . '%20' . $url( 'whatsapp' ) ),
		'telegram'  => array( 'label' => 'Telegram',  'url' => 'https://t.me/share/url?url=' . $url( 'telegram' ) . '&text=' . $title ),
		'email'     => array( 'label' => 'Email',     'url' => 'mailto:?subject=' . $title . '&body=' . $url( 'email' ) ),
	);
}

// 2) Print the buttons. The hidden count spans stay empty until you add the counter snippet.
function athemeart_share_buttons_html( $post_id = 0 ) {
	$post_id = $post_id ? (int) $post_id : get_the_ID();

	$html  = '<div class="athemeart-share" data-post-id="' . esc_attr( $post_id ) . '">';
	$html .= '<p class="athemeart-share__label">' . esc_html__( 'Share this post', 'textdomain' ) . '</p><ul>';

	foreach ( athemeart_get_share_links( $post_id ) as $key => $item ) {
		$target = ( 'email' === $key ) ? '' : ' target="_blank"';
		$html  .= sprintf(
			'<li><a class="athemeart-share__link athemeart-share__link--%1$s" href="%2$s"%3$s rel="noopener nofollow" data-network="%1$s"><span class="athemeart-share__name">%4$s</span> <span class="athemeart-share__count" data-count-for="%1$s" hidden>0</span></a></li>',
			esc_attr( $key ),
			esc_url( $item['url'] ),
			$target,
			esc_html( $item['label'] )
		);
	}

	$html .= '<li class="athemeart-share__total-wrap" hidden><strong class="athemeart-share__total">0</strong> ' . esc_html__( 'shares', 'textdomain' ) . '</li>';
	$html .= '</ul></div>';

	return $html;
}

// 3) Add the buttons below every single post, and offer a [athemeart_share] shortcode.
function athemeart_append_share_buttons( $content ) {
	if ( is_singular( 'post' ) && in_the_loop() && is_main_query() ) {
		$content .= athemeart_share_buttons_html();
	}
	return $content;
}
add_filter( 'the_content', 'athemeart_append_share_buttons' );

function athemeart_share_shortcode() {
	return athemeart_share_buttons_html();
}
add_shortcode( 'athemeart_share', 'athemeart_share_shortcode' );

Step 2: a little CSS

Add this to your child theme stylesheet or the Customizer. If you are not sure where custom styles go, see how to add custom CSS in WordPress.

.athemeart-share { margin: 32px 0; }
.athemeart-share__label { margin: 0 0 8px; font-weight: 700; }
.athemeart-share ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.athemeart-share__link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; background: #233d62; color: #fff; font-size: 14px; text-decoration: none; }
.athemeart-share__link:hover { background: #37bf91; color: #fff; }
.athemeart-share__count { padding: 0 7px; border-radius: 10px; background: rgba(255, 255, 255, .2); font-size: 12px; }
.athemeart-share__total-wrap { align-self: center; font-size: 14px; }

UTM tags are safe for SEO as long as the page has a canonical tag that points to the clean URL, which the major SEO plugins add by default. If you use a different SEO setup, confirm it before you ship this.

Optional: a native share button for mobile

Phones can open the system share sheet, which lists every app the visitor already uses. The browser’s Web Share API makes that possible in a few lines. The button below stays hidden on browsers that do not support it, so nobody sees a dead control.

// Markup: <button type="button" class="athemeart-native-share" hidden>Share</button>
document.addEventListener( 'DOMContentLoaded', function () {
	var button = document.querySelector( '.athemeart-native-share' );

	// Only show the button on browsers that support the Web Share API (mostly mobile).
	if ( ! button || ! navigator.share ) {
		return;
	}

	button.hidden = false;
	button.addEventListener( 'click', function () {
		navigator.share( { title: document.title, url: window.location.href } ).catch( function () {} );
	} );
} );

Shared counts code: a WordPress and AJAX share counter

This is the missing piece in most “best plugin” lists. The code below counts clicks on the buttons from the previous section, saves the totals as post meta and refreshes the numbers through WordPress AJAX. It does not rely on any social network’s API, so it keeps working when a network changes its rules.

Visitor clicksa share buttonadmin-ajax.phpvalidate + throttlePost metacounts savedJSON replypage updates
A click is validated, counted once, saved and sent back to the page as JSON.

Two design choices make it production-friendly:

  • Counts load after the page. The script asks for fresh numbers when the page opens, so full-page caches and CDNs never serve stale totals.
  • Clicks are throttled. A salted hash of the visitor, post and network is stored in a short-lived , so repeat clicks within a minute count once. Nothing readable is kept, and the entry expires by itself.

The handlers follow the standard WordPress approach for front-end requests, with wp_ajax_ and wp_ajax_nopriv_ hooks for logged-in and logged-out visitors. If you want to go deeper, the official guide to explains the pattern. We skip a nonce on purpose here, because a nonce printed into a cached page expires and would break the counter. The network whitelist, post-status check and throttle protect the endpoint instead.

Step 1: the PHP and AJAX handlers

/**
 * Self-hosted share counter (counts clicks on your own share buttons).
 * Works together with the share buttons snippet above.
 */

// Networks we are willing to count (whitelist).
function athemeart_share_networks() {
	return array( 'facebook', 'x', 'linkedin', 'pinterest', 'whatsapp', 'telegram', 'email' );
}

// Read the saved counts for a post.
function athemeart_get_counts( $post_id ) {
	$saved  = get_post_meta( $post_id, '_athemeart_share_counts', true );
	$saved  = is_array( $saved ) ? $saved : array();
	$counts = array();

	foreach ( athemeart_share_networks() as $network ) {
		$counts[ $network ] = isset( $saved[ $network ] ) ? absint( $saved[ $network ] ) : 0;
	}

	return $counts;
}

function athemeart_counts_payload( $post_id ) {
	$counts = athemeart_get_counts( $post_id );
	return array(
		'counts' => $counts,
		'total'  => array_sum( $counts ),
	);
}

// AJAX: return fresh counts (used on page load, so cached pages never show stale numbers).
function athemeart_ajax_get_share_counts() {
	$post_id = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;

	if ( ! $post_id || 'publish' !== get_post_status( $post_id ) ) {
		wp_send_json_error( array( 'message' => 'Invalid post.' ), 400 );
	}

	wp_send_json_success( athemeart_counts_payload( $post_id ) );
}
add_action( 'wp_ajax_athemeart_get_share_counts', 'athemeart_ajax_get_share_counts' );
add_action( 'wp_ajax_nopriv_athemeart_get_share_counts', 'athemeart_ajax_get_share_counts' );

// AJAX: count one click, then return the new numbers.
function athemeart_ajax_track_share() {
	$post_id = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;
	$network = isset( $_POST['network'] ) ? sanitize_key( wp_unslash( $_POST['network'] ) ) : '';

	if ( ! $post_id || 'publish' !== get_post_status( $post_id ) || ! in_array( $network, athemeart_share_networks(), true ) ) {
		wp_send_json_error( array( 'message' => 'Invalid request.' ), 400 );
	}

	// Throttle repeat clicks: one count per visitor, post and network every 60 seconds.
	// Only a salted hash is stored, and the transient expires on its own.
	$ip  = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
	$key = 'ath_share_' . md5( wp_salt() . $ip . $post_id . $network );

	if ( ! get_transient( $key ) ) {
		$counts = athemeart_get_counts( $post_id );
		$counts[ $network ]++;
		update_post_meta( $post_id, '_athemeart_share_counts', $counts );
		set_transient( $key, 1, MINUTE_IN_SECONDS );
	}

	wp_send_json_success( athemeart_counts_payload( $post_id ) );
}
add_action( 'wp_ajax_athemeart_track_share', 'athemeart_ajax_track_share' );
add_action( 'wp_ajax_nopriv_athemeart_track_share', 'athemeart_ajax_track_share' );

// Load the script on single posts and pass it the AJAX URL.
function athemeart_enqueue_share_counter() {
	if ( ! is_singular( 'post' ) ) {
		return;
	}

	wp_enqueue_script(
		'athemeart-share-counter',
		get_stylesheet_directory_uri() . '/js/share-counter.js',
		array(),
		'1.0.0',
		true
	);

	wp_localize_script(
		'athemeart-share-counter',
		'athemeartShare',
		array(
			'ajaxUrl'  => admin_url( 'admin-ajax.php' ),
			'postId'   => get_the_ID(),
			// Hide a number until it reaches this value, so new posts never show "0".
			'minCount' => (int) apply_filters( 'athemeart_share_min_count', 5 ),
		)
	);
}
add_action( 'wp_enqueue_scripts', 'athemeart_enqueue_share_counter' );

Step 2: the JavaScript

Create a js folder in your child theme and save this as share-counter.js. It fetches the numbers on load, counts clicks and hides any number below your minimum.

/* Save as /js/share-counter.js inside your child theme. */
( function () {
	'use strict';

	if ( typeof athemeartShare === 'undefined' ) {
		return;
	}

	var box = document.querySelector( '.athemeart-share' );
	if ( ! box ) {
		return;
	}

	var minCount = Math.max( parseInt( athemeartShare.minCount, 10 ) || 0, 1 );

	function send( action, extra ) {
		var params = new URLSearchParams(
			Object.assign( { action: action, post_id: athemeartShare.postId }, extra || {} )
		);

		return fetch( athemeartShare.ajaxUrl, {
			method: 'POST',
			credentials: 'same-origin',
			headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
			body: params.toString()
		} ).then( function ( response ) {
			return response.json();
		} );
	}

	function render( result ) {
		if ( ! result || ! result.success ) {
			return;
		}

		Object.keys( result.data.counts ).forEach( function ( network ) {
			var el = box.querySelector( '[data-count-for="' + network + '"]' );
			var n  = result.data.counts[ network ];

			if ( el ) {
				el.textContent = n;
				el.hidden = n < minCount;
			}
		} );

		var wrap  = box.querySelector( '.athemeart-share__total-wrap' );
		var total = box.querySelector( '.athemeart-share__total' );

		if ( wrap && total ) {
			total.textContent = result.data.total;
			wrap.hidden = result.data.total < minCount;
		}
	}

	// 1) Fetch fresh numbers when the page loads (safe with page caching).
	send( 'athemeart_get_share_counts' ).then( render ).catch( function () {} );

	// 2) Count a click, then refresh the numbers.
	box.addEventListener( 'click', function ( event ) {
		var link = event.target.closest( 'a[data-network]' );

		if ( ! link ) {
			return;
		}

		send( 'athemeart_track_share', { network: link.getAttribute( 'data-network' ) } )
			.then( render )
			.catch( function () {} );
	} );
}() );

Want a different threshold? Change it with a filter in the same file, for example add_filter( 'athemeart_share_min_count', function () { return 10; } );. If you outgrow post meta, for instance with a site that has hundreds of thousands of posts, move the counts to a custom table and keep the same AJAX routes.

Plugin or custom code?

Choose a plugin when you want

  • Dozens of networks and ready-made designs
  • Analytics, A/B tests or popups without coding
  • Real network counts or count recovery
  • Vendor support and automatic updates

Choose code when you want

  • Four to seven networks and nothing else
  • The lightest possible page
  • Full control over markup and privacy
  • A counter that does not depend on any API

Share button best practices that actually move the needle

  • Fewer buttons, better chosen. Pick four to six networks your audience uses. A long row of icons makes people choose, and choosing is where they quit.
  • Place them where the decision happens. A floating bar suits long guides, buttons after the last paragraph suit short posts, and a native share button is the quickest option on phones.
  • Write the share text for people. Pre-fill the title, and add a Pinterest image and description for visual posts.
  • Track each network. UTM tags in the share URL show which networks send visits that read, not just click.
  • Do not show weak numbers. Hide counts until they help you.
  • Keep readers moving. Sharing is one action, and reading the next article is another. A strong set of related post plugins keeps the session going after the share prompt.
  • Watch performance. Disable modules you do not use, load scripts only on the pages that need them and retest your speed after every change.
  • Be clear about privacy. Plain share links set no cookies, but counters, like buttons and chat widgets may store data. Update your privacy notice to match.

Social sharing also helps SEO indirectly: more readers can mean more links and more branded searches. It works best on top of solid fundamentals, so pair these tips with our beginner’s guide to WordPress on-page SEO.

Frequently asked questions

What is the best WordPress social share plugin?

It depends on the job. Easy Social Share Buttons is the most complete option, Social Share & Locker Pro is strongest for lead magnets, WPZOOM Connect and Ultimate Social Media Icons are good free starting points, and FS Poster is the one to pick for posting to your own accounts.

How do I add social share buttons in WordPress without a plugin?

Build links to each network’s share URL for the current post and print them with a filter on the_content. The code in this guide does that, adds UTM tags and works with a shortcode too.

Which plugin shows share counts?

Social Share & Locker Pro, Easy Social Share Buttons, WPZOOM Connect Pro and Ultimate Social Media Icons all support counts, each in a different way. See the share counts table above for the details.

Do share counters work with page caching?

They do if the plugin refreshes numbers after the page loads. A counter printed straight into cached HTML goes stale. The AJAX counter in this guide fetches fresh numbers on every visit for exactly that reason.

Do social share buttons help SEO?

Not directly in any guaranteed way. They help your content reach more people, and that can lead to links, mentions and return visits, which do support SEO.

Are social share plugins GDPR-friendly?

Plain share links are generally privacy-friendly, but plugins that load third-party scripts, store IP addresses or set cookies need extra care. Read each plugin’s privacy notes and update your own policy to match.

What is a “share to social media” plugin?

The phrase usually means one of two things: buttons that let readers share your post, or an auto-poster that publishes your post to your own accounts. This list covers both, and FS Poster is the auto-poster.

Can I use two social share plugins at once?

You can, but it is rarely worth it. Duplicate buttons, clashing styles and extra requests are common. Pick one main plugin and use code or a floating-button tool for any small extras.

Final thoughts

The right choice comes down to what you want a share to do. If you need the broadest toolset, go with Easy Social Share Buttons, either on CodeCanyon or through the official site. If sharing is a lead-generation tool, Social Share & Locker Pro is built for it. If you want free and fast, start with WPZOOM Connect or Ultimate Social Media Icons. And if all you need is four or five links on the bottom of a post, the code in this guide is lighter than any plugin.

Whichever route you take, test it on a staging site, measure your page speed before and after, and keep the counter honest. When you are ready to round out the rest of your stack, our list of must-have WordPress plugins is a good next stop.

Inspire us with your love!

Saiful Islam

By Saiful Islam

Saiful Islam, the founder of aThemeArt, is a successful freelancer, a father of two boys, and an enthusiast in coding, YouTube, and gaming. Connect with me on Twitter, Facebook, and Instagram to stay updated with my latest endeavors.

You can check also

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*