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.
has_footer_svg_sprite
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.
has_enable_image_sharing_on_singular_featured
Allow image sharing on featured images (post thumbnails) on singular posts/pages. Default false to avoid large hero images with sharing buttons.
/**
* Filter: has_enable_content
*
* @param bool $enable True to enable HAS on post content, false to disable.
*/
add_filter( 'has_enable_content', function( $enable ) {
return $enable;
} );
/**
* Filter: has_enable_excerpt
*
* @param bool $enable True to enable HAS on excerpts, false to disable.
*/
add_filter( 'has_enable_excerpt', function( $enable ) {
return $enable;
} );
/**
* Filter: has_highlight_sharing_enabled_for_post
*
* @param bool $enabled Whether highlight sharing is enabled for the post.
* @param int $post_id The current post ID.
* @since 7.0.0
*/
add_filter( 'has_highlight_sharing_enabled_for_post', function( $enabled, $post_id ) {
return $enabled;
}, 10, 2 );
/**
* Filter: has_headlines_enabled_for_post
*
* @param bool $global_enabled Global headlines enabled state for this context.
* @param int $post_id Current post ID.
* @return bool Whether headlines should run for this post.
*/
add_filter( 'has_headlines_enabled_for_post', function( $global_enabled, $post_id ) {
return $global_enabled;
}, 10, 2 );
/**
* Filter: has_pin_show_on_archives
*
* @param bool $show Whether to show image sharing on archives. Default true.
* @param string $post_type The post type (from get_post_type()).
*/
add_filter( 'has_pin_show_on_archives', function( $show, $post_type ) {
return $show;
}, 10, 2 );
/**
* Filter: has_pin_supported_post_types
*
* @param array $supported_slugs Array of post type slugs (e.g. post, page).
*/
add_filter( 'has_pin_supported_post_types', function( $supported_slugs ) {
return $supported_slugs;
} );
/**
* Filter: has_image_sharing_enabled_for_post
*
* @param bool $global_enabled Global enabled state from settings and post type.
* @param int $post_id The post ID.
*/
add_filter( 'has_image_sharing_enabled_for_post', function( $global_enabled, $post_id ) {
return $global_enabled;
}, 10, 2 );