WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Want to add custom Taxonomy term when registering a user (3 posts)

  1. Gyroscopic
    Member
    Posted 3 years ago #

    Hi All

    I want a new user (with custom fields, on a custom page) to be able to register and want to add their Business name to a custom taxonomy called 'business' automatically.

    I have the code working to register the user and I have registered the taxonomy but am unsure how to 'manually' add the Business name to the taxonomy upon user registration.

    Should I use wp_update_term or wp_insert_category or something else?
    And how should I use them? The codex is not very clear regarding custom taxonomies (for me anyway!).

    As back ground, I am coding this by hand so do not want to use a plugin if at all possible. Also the custom taxonomy will NOT be linked to a post type, not that that should make any difference I guess.

    Anyway thanks in advance for any advice!

  2. Gyroscopic
    Member
    Posted 3 years ago #

    Fixed this by using

    wp_set_object_terms( "", $_POST['business_name'], 'business_taxonomy' )

    All done when registering the user!

  3. WebTechGlobal
    Member
    Posted 2 years ago #

    First parameter is required. Just noting for anyone else who finds this.

    I think it should be a post ID or user ID etc

Topic Closed

This topic has been closed to new replies.

About this Topic