Biranit Goren

Vladimir, I think I know what is happening.

Your solution to the issue reported here, I believe, was to add the function “auto_assign_term”. However, this is a really problematic solution — and in my website’s case, I think it might not work at all. Here’s why.

Let’s say that I have user called Joe who is allowed to publish his own blog posts, but also has permissions to publish/edit posts on behalf of an organization called YMCA. We have a custom taxonomy called “organizations”. So this user can add stories “by Joe” or stories “By Joe for YMCA”. He can also edit other stories that were published for YMCA.

Now, with your function auto_assign_term — you are a) forcing that post to have this custom taxonomy attached to it, when we don’t actually want it; and b) because we have a different wp_set_post_terms() function running on save_post, we are essentially deleting the term you auto_assigned.

This is my guess.

In my opinion, the correct way to solve this issue is for you to create a custom taxonomny called “ure” (for example) which has a single term called “allow” — and you assign THAT term to any new post by that user. This way, this term will never be deleted by any other plugin or function, your custom taxonomy is hidden and doesn’t clash with existing taxonomies, and by adding THAT you will ensure a user can always add posts even before or without setting the taxonomy he’s restricted to.

Your thoughts?