• Pete

    (@perthmetro)


    I’m trying to find a function that will block a (second, third, forth…) author to publish a post with a category that has already been assigned to an author’s post.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Maybe it is an idea to re-think how you’re using categories? It could be easier to assign a unique custom taxonomy to each author?

    Thread Starter Pete

    (@perthmetro)

    No, I have hundreds of authors, with more each day.

    Moderator bcworkz

    (@bcworkz)

    You can use term meta to establish the category term’s “owner”. If any one besides the owner tries to use it, it will be rejected. The main way to enforce this is the ‘added_term_relationship’ action. Unless the post’s author matches the term’s owner, the term is removed from the post. While it makes more sense to prevent this before it is added, there isn’t any useful hook that I saw related to adding categories to new posts.

    I haven’t looked at the process before the post is saved, there may be something there to use. Ideally, the UI would be adjusted so no one but the owner can even see the category or add it. I leave these details to others. The main enforcement can be achieved through ‘added_term_relationship’.

    Thread Starter Pete

    (@perthmetro)

    Thanks, I’m not a coder (at all) so i’m a bit stuck at the moment. Thanks a lot anyway.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Only allow 1 post per category – first in first served’ is closed to new replies.