• I have a custom post type with custom taxonomy. Is there a way to set restrictions on post creation for certain taxonomy term? What I look for is capability-based solution so I can hook up Groups (or any other) plugin for membership management.

    I know groups allows read restrictions on content, but what I also need is posting restriction.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    When you register a CPT, you can define custom capabilities to manage various aspects of viewing, editing, publishing, and creating that CPT. One useful capability is ‘create_my_cpt’ (or whatever you want to call it) that is checked when “Add New” is clicked for that CPT.

    At this point it’s not possible to restrict by taxonomy term because none have been assigned. When registering a taxonomy, there are similar capabilities that can be defined, but they apply to the entire taxonomy, not specific terms. What you could do is create two related taxonomies, one for allowed terms and one for restricted terms. Only admins can assign restricted terms, but anyone that can create the associated CPT can assign allowed terms.

    It’s relatively simple to filter (by any arbitrary logic) what happens to a post once it’s submitted, but rather difficult to prevent similar things before the post is submitted. You could hide things on the edit screen with CSS, then enforce not using the hidden elements once the post is submitted for those clever enough to unhide the forbidden options.

Viewing 1 replies (of 1 total)
  • The topic ‘Restrict posting by taxonomies’ is closed to new replies.