Skip to content

Snippet: Add Query Argument To Social Share Links

/**
 * Append new query args to the social share url
 * Result in this example will return http://your-site.com/post-slug/?key=value
 *
 */
function my_alter_social_link( $url ) {
	return add_query_arg( array(
		'key' => 'value',
	), $url );
}
add_filter( 'wpex_social_share_url', 'my_alter_social_link', 20 );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top