$term_id
$term_id :
This class represents a WooCommerce category with various functions to test its visibility.
check_password(string $password,boolean $check_ancestors = true): boolean|integer
Checks if the supplied password is valid for this category. If the password is valid, it returns the term_id (an integer) for the category the password is valid for.
string | $password | The password to check |
boolean | $check_ancestors | Whether to check passwords against ancestor categories as well. |
The term ID the password is valid for, or false if not valid.
is_public(boolean $check_ancestors = false): boolean
Is this category public?
If $check_ancestors is true, and this category is public, all ancestor categories will also be checked. If any are not public, then this function returns false.
boolean | $check_ancestors | Whether the check the ancestors as well. |
true if public.
is_protected(boolean $check_ancestors = false): boolean
Is this category protected? 'Protected' can mean a password is required, or the category is locked to specific roles or users.
This function will return false for private categories, and there is a separate function (is_private) to check for private level access.
If $check_ancestors is true, and this category is not protected, its ancestor categories will also be checked. The function halts once the first protected ancestor is found. *
boolean | $check_ancestors | Whether to check the ancestor categories as well (if any). |
true if this category is protected.
is_password_protected(boolean $check_ancestors = false): boolean
Is this category password protected?
If $check_ancestors is true, and this category is not password protected, the ancestors will also be checked. The function halts once the first password protected ancestor is found.
boolean | $check_ancestors | Whether to check the ancestor categories as well (if any). |
true if this category is password protected.
is_user_protected(boolean $check_ancestors = false): boolean
Is this category protected by user (i.e. only specific users have access)?
boolean | $check_ancestors | Whether to check the ancestor categories as well (if any). |
true if this category is user protected.
is_private(boolean $check_ancestors = false): boolean
Is this category private? A private category is one that can only be viewed by users with the 'read_private_products' capability.
If $check_ancestors is true, and this category is not private, its ancestor categories will also be checked. The function halts once the first private ancestor is found.
boolean | $check_ancestors | Whether to check the ancestors as well. |
true if private.
correct_password_entered(): boolean
Returns true if this category has had the correct password entered by the current user. The category password cookie is checked, and if it matches any one of the passwords for this category, then it returns true, otherwise returns false.
true if the correct password has been entered.