Email code crashed site
-
Hi,
I pasted some code in the functions.php file that said it would put in a customers name into an email, but instead it has locked me out of being able to access my wp-admin. The code displays on the wp-admin page instead of bringing up the login box. This is the code causing the issue:
function custom_use_customer_from_address ( $from_email, $obj ) { if ( is_a( $obj, ‘WC_Email_New_Order’ ) ) { $address_details = $obj->object->get_address( ‘billing’ ); if ( isset( $address_details[’email’] ) && ” != $address_details[’email’] ) { $from_email = $address_details[’email’]; } } return $from_email; } add_filter( ‘woocommerce_email_from_address’, ‘custom_use_customer_from_address’, null, 2 ); function custom_use_customer_from_name ( $from_name, $obj ) { if ( is_a( $obj, ‘WC_Email_New_Order’ ) ) { $address_details = $obj->object->get_address( ‘billing’ ); if ( isset( $address_details[‘first_name’] ) && ” != $address_details[‘first_name’] ) { $from_name = $address_details[‘first_name’]; } if ( isset( $address_details[‘last_name’] ) && ” != $address_details[‘last_name’] ) { $from_name .= ‘ ‘ . $address_details[‘last_name’]; } } return $from_name; } add_filter( ‘woocommerce_email_from_name’, ‘custom_use_customer_from_name’, null, 2 );
Please could this be fixed/looked at, as I would really like to use this for my business.
Thanks
The topic ‘Email code crashed site’ is closed to new replies.