Script contains PHP and does not work
-
Hello,
I was testing “3rd party cookies” functionality and faced one issue. One of my scripts that I had in functions.php file has some dynamic info (current user email address) that I gather using PHP. After getting user email I just echo it inside the JS script.
<?php $current_user = wp_get_current_user(); $userEmail = $current_user->user_email; ?> <script defer async type="text/javascript"> var cpaAccount='test'; var cpaE='<?php echo $userEmail; ?>'; ............ </script>When I place that code inside the “3rd party cookies” section it does not work. Looks like, that it does not understand the PHP part and works only JS part.
Any suggestions or workarounds for this?
Thank you.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Script contains PHP and does not work’ is closed to new replies.