In your PHP you are localizing the script using wp_localize_script()
. The way you’ve used it will create an object in JS named messageClip
with the string as the copy
property, but then in your JavaScript you’re not actually using this. In your JavaScript just get rid of const message
etc. and use:
buttonclip.on('success', function(e){
e.trigger.textContent = messageClip.copy;
});