我想在用户在我的网站上完成注册后触发功能。
我搜索了下一个钩子(Hook),但没有找到:
woocommerce_after_customer_register_form
我只找到了这个:
woocommerce_after_checkout_registration_form
这对我没有帮助,因为我是在网站上的注册表单之后搜索的,而不是在结帐之后搜索的。
用户注册后我需要使用什么技巧来触发功能?
最佳答案
WordPress 核心处理用户注册并运行 user_register
用户注册后立即 Hook 。
以手抄本为例:
add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
if ( isset( $_POST['first_name'] ) )
update_user_meta($user_id, 'first_name', $_POST['first_name']);
}
关于php - woocommerce/wordpress 注册后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28135954/