1

I have extra metadata (true/false) for taxonomy terms. What I'm trying to accomplish is give this field a value for new terms created by users (it doesn't matter if that value is true or false, just matters theres a value).

This tag metadata field would act as a "flag" for these term, letting me know that they were created by someone other than me. I then would be easily able to prevent those terms from being loaded again for other users before I looked at them.

You could think of it as quality control.

1
  • I suppose a proceeding question is whether you can link an author/creator of a given tag to that tag (I'm referring to tags added via a frontend form by a user). I'm pretty surprised I haven't come across this question on here.
    – Dan
    Commented May 6, 2018 at 9:09

1 Answer 1

3

to add a meta value on a term creation, you can use that :

const TAXONOMIE_SLUG = "category";

add_action("create_" . TAXONOMIE_SLUG, function ($term_id, $tt_id) {

    $user = wp_get_current_user();

    update_term_meta($term_id, "creationUser", $user->ID);

}, 10, 2);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.