Hi there!
Is there a workaround for getting the social share buttons to include the URL-query in the link-to-be-shared?
Currently the link shared through the social share buttons only include the clean URL, and not any “?”-queries.
Link for the website in question in Private Content.
Please do let me know if you’ll be needing login-/ftp-access, or further info :)
Thank you so much in advance!
Hey Martin,
Thank you for using Enfold.
You can use the “avia_social_share_link_replace_values” to adjust the value of the default shortlink or permalink. The current value is based on the get_permalink function. Example:
add_filter('avia_social_share_link_replace_values', 'avia_social_share_link_replace_values_mod');
function avia_social_share_link_replace_values_mod($replace) {
$replace['shortlink'] = get_permalink(); // you can change this
$replace['permalink'] = get_permalink(); // you can change this
return $replace;
}
Best regards,
Ismael
Amazing, thank you so much!
Can I assume this is quite safe (thinking XSS-exploits) to use, then?
add_filter('avia_social_share_link_replace_values', 'avia_social_share_link_replace_values_mod');
function avia_social_share_link_replace_values_mod($replace) {
$replace['shortlink'] = esc_url( $_SERVER['HTTP_HOST'] ) . esc_url( $_SERVER['REQUEST_URI'] ); // you can change this
$replace['permalink'] = esc_url( $_SERVER['HTTP_HOST'] ) . esc_url( $_SERVER['REQUEST_URI'] ); // you can change this
return $replace;
}