php WooCommerce会员 - 检查用户是否是计划的成员

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php WooCommerce会员 - 检查用户是否是计划的成员相关的知识,希望对你有一定的参考价值。

// Get current user ID
$user_id = get_current_user_id();

// Check if the user is member of the plan 'gold'
if ( wc_memberships_is_user_active_member( $user_id, 'gold' ) ) {
    echo 'This is a special message only for Gold members!';
} else {
    echo 'I\'m sorry, you are not a gold member. There's nothing here for you!';
}

以上是关于php WooCommerce会员 - 检查用户是否是计划的成员的主要内容,如果未能解决你的问题,请参考以下文章

WooCommerce 会员资格检查用户(具有当前会员计划)是不是能够访问内容

php 查询WooCommerce会员资格和FacetWP

php 查询WooCommerce会员资格和FacetWP

php 查询WooCommerce会员资格和FacetWP

php 查询WooCommerce会员资格和FacetWP

php 兼容多厂商市场的WooCommerce会员资格