-
-
Save clifgriffin/697d99bc221739e67065cc953cbb70f7 to your computer and use it in GitHub Desktop.
<?php | |
// Do NOT include the opening php tag. | |
// Place in your theme's functions.php file | |
add_filter( 'woocommerce_new_customer_data', function( $data ) { | |
$data['user_login'] = $data['user_email']; | |
return $data; | |
} ); |
Hi, sorry for the rookie Q but where/how do I add this code?
Appreciate your time!
Hi, sorry for the rookie Q but where/how do I add this code?
Appreciate your time!
2 options:
- WP ADMIN:
-
Appearances > Theme Editor > Theme Functions
-
add the code snippet at the very bottom
-
SAVE
- FILE (maybe use FTP)
-
[root/wp folder] > wp-content > themes > [theme name] > functions.php
-
add the code snippet at the very bottom
-
reupload the file.
Hi, sorry for the rookie Q but where/how do I add this code?
Appreciate your time!2 options:
- WP ADMIN:
Appearances > Theme Editor > Theme Functions
- add the code snippet at the very bottom
- SAVE
- FILE (maybe use FTP)
[root/wp folder] > wp-content > themes > [theme name] > functions.php
- add the code snippet at the very bottom
- reupload the file.
It's not the most rational approach to insert your code directly into the functions.php file. This is because it might be overwritten during theme updates.
Probably the best option is to use a snippet plugin like Code Snippets or WPCode. These plugins allow you to add and manage code snippets easily, without directly modifying theme files.
Alternatively, you can consider adding your code snippets to the functions.php file of a child theme. This way, your customizations are not likely to be affected by theme updates, providing a more stable and update-friendly solution 🙂
Works perfectly well 🙏🏼👍🏼