Skip to main content

better_messages_before_message_sent

REQUIREMENTS

To be able to implement this guide, you need to learn how to use JS snippets at your website.

One of guides: https://dev.to/david_woolf/how-to-get-started-with-wordpress-hooks-in-javascript-400o

Compatibility
This hook compatible with Better Messages 2.4.16 or higher

Allows preventing message sending or doing other javascript actions before a message is sent.

wp.hooks.addFilter('better_messages_before_message_sent', 'my_custom_actions', function (prevented, threadId, thread) {
if( ! confirm( "Are you sure you want to send the message?" ) ){
return true; //Prevents message sending
}

return false; // Do not prevent message sending
});