user3679330 user3679330 - 2 months ago 7x
PHP Question

Adding reference ID to messenger send button links

I have the following code:

<div class="fb-send" data-href="<?php $current_user->ID; ?>" data-size="small"></div>

I am trying to append the current user iD to the link and have that link shared via messenger, however when the messenger share button is clicked it only shares ""

any help would be much appreciated!

Thanks in advance

Oh and I also have the Javascript SDK included on the page before the


You just forgot to echo your variable :

<div class="fb-send" data-href="<?php echo $current_user->ID; ?>"  data-size="small"></div>