WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Want to add custom Taxonomy term when registering a user

[Resolved] Want to add custom Taxonomy term when registering a user

  • 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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Fixed this by using

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

    All done when registering the user!

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

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Want to add custom Taxonomy term when registering a user’ is closed to new replies.
Skip to toolbar