Changing wordpress/woocommerce notices default message to other languages (text)
I think you should use wordpress string translation function __(). Like below: add_filter(‘woocommerce_lost_password_message’, function () { return __(‘My custom message’); }); For more details https://developer.wordpress.org/reference/functions/__/