HM Social Links
WordPress Social Share Link's built on top of core social link buttons block and block bindings.
by Human Made · github.com/humanmade/hm-social-share-links · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/humanmade/hm-social-share-links/archive/refs/heads/main.zipWires the core Social Links block up to dynamic, per-page share-intent URLs (Facebook, X, LinkedIn, WhatsApp, Reddit, Pinterest, email) using the Block Bindings API — no custom block, no build step.
How it works
- Registers a block bindings source,
hm-social-links/share-link, whoseget_value_callbackbuilds a share URL for the current post from anetworkarg (inc/namespace.php). - Adds
core/social-link'surlattribute to the editor's supported binding attributes (WP 6.9+), so the block shows the native connected/locked state instead of a plain editable field. - Ships a pattern (
patterns/share-links.php) — acore/social-linksblock with icons already bound to networks — registered under the "Social Links" pattern category.
Front-end resolution works from WP 6.5 (block bindings apply at render time regardless of editor support); the 6.9 attribute filter only affects the editor's UI/locking behaviour.
Usage
Activate the plugin, then insert the "Share Links" pattern from the block
inserter. Add, remove, or reorder icons as normal — each core/social-link
block just needs a service matching one of the network keys below, with a
metadata.bindings.url pointing at hm-social-links/share-link and that
same key as the network arg.
Local testing (WordPress Playground)
No local PHP/MySQL/Docker needed — WordPress Playground runs WordPress in-process via WASM.
npm install
npm run playground:start
This mounts the working directory as an active plugin (--auto-mount), on
WP latest, landing straight in the post editor so you can insert the
pattern and check the bound URLs. Config lives in blueprint.json.
The README badge above uses a second file, blueprint-demo.json — it can't
use --auto-mount (there's no local filesystem in a browser), so it
installs the plugin from a zip of this repo's main branch instead. It only
works once this repo is pushed to humanmade/hm-social-share-links and
blueprint-demo.json is present on main, since Playground fetches it live
from raw.githubusercontent.com.
Extending
Add, remove, or override networks with the hm_social_links_networks
filter rather than editing the plugin:
add_filter( 'hm_social_links_networks', function ( array $networks, string $url, string $title, int $post_id ) {
$networks['telegram'] = 'https://t.me/share/url?url=' . rawurlencode( $url ) . '&text=' . rawurlencode( $title );
unset( $networks['pinterest'] );
return $networks;
}, 10, 4 );
Network keys should match a core/social-link service slug so the same
key drives both the icon and the bound URL.
Requirements
- WordPress 6.9+ (for the editor-side connected/locked UI; render-time binding resolution works from 6.5)
- PHP 7.4+