Hi, for me it’s a bit unclear what you’re trying to achieve here. On a WordPress site, AddToAny normally doesn’t require any custom JavaScript, you just install and activate the plugin and it automatically generates the correct share URLs for each post.
From your example, it seems you are trying to do something more custom which involves manually passing the post URL/title back into the script.
Could you clarify what the end goal is? For example, are you trying to track shares, or customise the shared URL?
On a standard WordPress post, there’s nothing to “expose”. The post URL and title already exist in the rendered page, and JavaScript can read them directly.
The URL is already available via window.location.href and The title is already available via document.title, or document.querySelector('h1').textContent. Is there any reason you cannot use those?