I am trying to make my WordPress registration form GDPR compliant where the user needs to check a checkbox that they accept our privacy policy.
I have successfully made the checkbox by using the hook register_form
.
However, I am having issues making the checkbox field required. I have tried with required true in my array but it doesn't seem to work. I can someone explain what I can do in order to make the checkbox required?
add_action( 'register_form', 'login_extra_note' );
function login_extra_note() {
woocommerce_form_field( 'privacy_policy_reg', array(
'type' => 'checkbox',
'class' => array('form-row privacy'),
'label_class' => array('label-for-checkbox checkbox'),
'input_class' => array('form__input-checkbox input-checkbox'),
'required' => true,
'label' => 'Jeg har læst og acceptere <a href="https://example.dk/privatliv/" target="blank">Betingelser & Privatlivspolitik</a>',
));
}
Aucun commentaire:
Enregistrer un commentaire