woocommerce/wordpress 注册后 [英] After woocommerce/wordpress registration

查看:32
本文介绍了woocommerce/wordpress 注册后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户在我的网站上完成注册后触发功能.

I want to fire function after user finish his registration on my site.

我搜索了下一个钩子,但没有找到:

I searched for next hook, but didn't found:

woocommerce_after_customer_register_form

我只找到了这个:

woocommerce_after_checkout_registration_form

这对我没有帮助,因为我在网站上搜索后注册表格,而不是在结帐后搜索.

That's not help me, because i search for after register form on the site, and not after the checkout.

用户注册后我需要使用什么技巧来触发功能?

What is the trick i need to use to fire function after user registered ?

推荐答案

WordPress 核心处理用户注册并运行 user_register 在用户注册后立即挂钩.

WordPress core handles user registration and runs the user_register hook right after a user is registered.

从抄本中举一个例子:

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']);

}

这篇关于woocommerce/wordpress 注册后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆