Tuesday, October 25, 2022
HomeWordPress Developmentjavascript - comment_post perform with js not working

javascript – comment_post perform with js not working


I am making an attempt to import commenters particulars from WP into Klaviyo utilizing the add_action(‘comment_post) however can not get it to work when submitting a remark.

I’ve run the perform manually on a take a look at web page so it does hearth accurately and the e-mail is submitted to klaviyo, simply does not work when a remark is submitted.

Additionally swapped out the script for some customary instance equivalent to sending an e mail as a substitute, and that fires accurately.. so it tells me it does not just like the JS?

Is there a approach for me to fireplace this script part when a remark is submitted?

perform klaviyo_commenter($comment_ID, $commentdata) {
  ?>
  <script kind="textual content/javascript">
   var _learnq = _learnq || [];
     _learnq.push(['identify', {
    '$email' : "SAMPLE@EMAIL.COM",
   }]);
  </script>
<?php
}
add_action('comment_post', 'klaviyo_commenter', 10, 2 );

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments