Retrieving password protected categories
The following information is aimed at developers. If you don't know how to use it then you can use our plugin customization service.
If you are retrieving the category-tree with a custom WP REST API endpoint then you can add a parameter to retrieve password protected categories.
You can do this by adding the 'meta_key' and optionally adding the 'meta_value' parameters. For example, to retrieve all password protected categories, you could use:
$password_protected_cats = get_categories( [
'meta_key' => 'password'
] );
You can also achieve the same result by using using 'meta_value' together with 'meta_key'. So to select all password protected categories:
$private_cats = get_categories( [
'meta_key' => 'visibility',
'meta_value' => 'protected'
] );
The following example would select all private categories rather than password protected categories:
$private_cats = get_categories( [
'meta_key' => 'visibility',
'meta_value' => 'private'
] );
If searching the knowledge base hasn't answered your question, please contact support.