-3

I am using "Integrate Sendgrid Newsletter Subscription form on WooCommrece Register Page" answer code to one of my previous answers. On Woocommerce account details section of My account page, I have a custom user meta field which is receive_newsletter which by default has a value of "1" when is checked, like:

enter image description here

When it is unchecked the value will be empty and make it unchecked.

However when I save the changes it will not update.

This would be supposedly an output:

enter image description here

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Jm Cabugnason
  • 63
  • 1
  • 9

1 Answers1

-1

Just figured it out why it is not working, I did not check the value. Please use this if anyone having the same issue. sanitize_text_field()

Thanks all.

Jm Cabugnason
  • 63
  • 1
  • 9
  • Sorry but checkbox values doesn't need to be sanitized they just need to be escaped or replaced like [in my updated original answer](Integrate Sendgrid Newsletter Subscription form on WooCommrece Register Page) – LoicTheAztec May 15 '19 at 04:19