get_the_author_ID() has been deprecated. Try this instead:
echo xprofile_get_field_data( 'AD', get_the_author_meta( 'ID' ) );
Hi @henrywright, thanks for responding. So, that works in displaying the code but it don’t actually fetch the ad. It just shows the script code. I’m wondering if I can actually make it run the script. It is a Adsense Script.
Michael
What is the script language? If JavaScript then you will need to surround it with <script> tags.
Thanks again Henry, tried what you said like this but couldn’t get it to work.
<script><?php echo xprofile_get_field_data('AD', get_the_author_meta( 'ID' ) ); ?></script>
Do I need to take out the script tags from the profile field. However I notice there are two sets of them. The code on the buddypress profile field form looks like this:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-3864028244866881"
data-ad-slot="9938917139"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Any other suggestions? Right now the script actually shows up as text on the blog post with script tags and all that were pulled from the profile field.
Just tried a html only ad and it also just displays the text code of the ad.