Actions and Filters

Actions and Filters

Highlight and Share provides actions and filters so developers can customize behavior without editing plugin files. This document lists the hooks available in the plugin's PHP codebase.


Actions

has_enqueue_block_styles_scripts

Fires when the Click to Share block enqueues its styles and scripts in the block editor. Use this to enqueue your own block editor assets when the Highlight and Share block is in use.

/**
 * Action: has_enqueue_block_styles_scripts
 *
 * Fires after Highlight and Share block styles/scripts are enqueued in the editor.
 */
add_action( 'has_enqueue_block_styles_scripts', function() {
	// Enqueue custom block editor assets.
} );

Filters

has_social_network_defaults

Filter the default social networks array (labels, slugs, colors, share URL templates, etc.). Use this to add custom networks or modify built-in ones.

Example — modify the WhatsApp default (e.g. label, tooltip, or share URL):


has_show_{network_slug}

Determine whether a social network is shown. The filter name is dynamic: has_show_ + network slug (e.g. has_show_facebook, has_show_twitter, has_show_email). Built-in slugs include: facebook, twitter, linkedin, ok, vk, email, tumblr, copy, reddit, telegram, whatsapp, webshare, mastodon, threads, bluesky. Custom networks registered via has_social_network_defaults use their slug as well.


has_show_facebook

Hide or show the Facebook sharing option.


has_show_twitter

Hide or show the Twitter sharing option.


has_show_linkedin

Hide or show the LinkedIn sharing option.


has_show_ok

Hide or show the OK.ru sharing option.


has_show_vk

Hide or show the VK sharing option.


has_show_email

Hide or show the email sharing option.


has_show_tumblr

Hide or show the Tumblr sharing option.


has_show_copy

Hide or show the copy-to-clipboard option.


has_show_reddit

Hide or show the Reddit sharing option.


has_show_telegram

Hide or show the Telegram sharing option.


has_show_whatsapp

Hide or show the WhatsApp sharing option.


has_show_webshare

Hide or show the Web Share API option.


has_show_mastodon

Hide or show the Mastodon sharing option.


has_show_threads

Hide or show the Threads sharing option.


has_show_bluesky

Hide or show the BlueSky sharing option.


has_enable_content

Whether Highlight and Share runs on regular post or page content (e.g. inline highlighting and sharing).


has_enable_excerpt

Whether Highlight and Share runs on post excerpts.


has_highlight_sharing_enabled_for_post

Whether highlight-and-share (text selection sharing) is enabled for the current post.


has_headlines_enabled_for_post

Per-post override for headline sharing (sidebar share buttons on headings). Use to enable or disable headline sharing for specific posts.


Replace or add SVG sprite markup output in the footer (used for headline share panel icons when the main HAS container may not be present).


has_headline_share_url_template

Modify the share URL template for a given network in the headline sharing panel (e.g. Twitter, LinkedIn). Placeholders like %url% and %title% are replaced by the front-end script.

Example — use a custom share URL for WhatsApp in the headline sharing panel (placeholders such as %url% and %title% are replaced by the front-end script):


has_pin_show_on_archives

Whether image (pin) sharing is shown on archive and blog index pages.


has_pin_supported_post_types

List of post type slugs where image (pin) sharing is supported. Modify to add or remove post types.


has_image_sharing_enabled_for_post

Whether image sharing (pin/share on images) is enabled for a specific post.


has_pin_image_css_classes

CSS classes applied to the image sharing wrapper (e.g. position, show-on-hover). Add or remove classes.


has_pin_core_exclusions

CSS classes or identifiers that exclude an image from getting the pin/image sharing wrapper. Images (or their parents) containing these strings are skipped. Default includes has-no-pin.


has_pin_excerpt_exclusions

Same as has_pin_core_exclusions but applied only when processing excerpts. Use to add or remove excerpt-specific exclusions.


has_pin_show_on_excerpts

Whether image sharing is applied to post excerpts. Default true.


Allow image sharing on featured images (post thumbnails) on singular posts/pages. Default false to avoid large hero images with sharing buttons.

Last updated

Was this helpful?