I have created a custom post type called 'reports' to provide an easy method for providing monthly reports to specific people. I don't want users to have to login to view the reports and I also don't want any user to find reports intended for another user.
So I have created a custom taxonomy so I can create a term for each user. The term slug will be a random set of letters and numbers. I can manually create a 'random' slug, but I thought it would be better if the slug was programmatically created when adding the term. In this case the user would have to know their random term slug to view their reports, but they would never be able to guess another users slug.
Example slugs would be: /c8etv35n/john-doe-report-january-2018 /c8etv35n/john-doe-report-february-2018 /76w8o9ev/jane-doe-report-january-2018
With this type of arrangement, John Doe could view all of his reports in the taxonomy archive based on his random slug, but Jane Doe would not be able to guess how and where to find his reports and vice versa.
I have search high and low for help on this, but I have not found a clear explanation for how to do it. I have looked into the edit_terms hook and others like wp_update_term.
What I am hoping for is something like the save_post hook, then some way to affect the slug. I can handle the random string generation and everything else. If this is all possible, I would then just hide the 'slug' field from the Add Term screen and let the slug be generated randomly.