Restrict Taxonomy Access
Overview
Restrict public access to selected taxonomy archives. The snippet checks whether the current request is for one of the configured taxonomy slugs, then redirects visitors who do not have the required capability to the WordPress login URL.
Replace the placeholder taxonomy slugs in $protected_taxonomies with the taxonomies for the site. By default, the access check uses current_user_can( 'edit_posts' ).
Variants
- Procedural