Saving snippet throws 404 Error
-
Hi,
This seems to be related to the content of the snippet, since I am able to save some other snippets. I am trying to add first name and last name to my WooCommerce registration via code that i found on the web.
Simply adding an empty function shell like this works:
functionwooc_extra_register_fields() { } add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );
The moment I add something like this in the function I can’t save.
function wooc_extra_register_fields() { ?> <p class="form-row form-row-first"> <label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" /> </p> <p class="form-row form-row-last"> <label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" /> </p> <div class="clear"></div> <p class="form-row form-row-wide"> <label for="reg_billing_phone"><?php _e( 'Phone', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="billing_phone" id="reg_billing_phone" value="<?php if ( ! empty( $_POST['billing_phone'] ) ) esc_attr_e( $_POST['billing_phone'] ); ?>" /> </p> <?php } add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );
I tried disabling wp-spamshield, YoastSEO, JetPack, and some more but no changes. I have seen other people with similar issues on the forum, but no solution. Can you help?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Saving snippet throws 404 Error’ is closed to new replies.