Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8299071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:01:02+00:00 2026-06-08T16:01:02+00:00

I want to update some nodes in my system and update a particular taxonomy

  • 0

I want to update some nodes in my system and update a particular taxonomy attach to them. I need to do this work programmatically. I have node ids and term id and want to attach this term to this particular node. What should do the trick here??

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:01:03+00:00Added an answer on June 8, 2026 at 4:01 pm

    To get the node:

    $node = node_load($X); // $X is node ID.
    

    To attache a term ID – note that this is very different in D7:

    $node->taxonomy[$tid] = taxonomy_get_term($tid); // $tid is attaching term ID.
    

    To add revision:

    $node->revision = 1; 
    $node->log = "Programatically attached taxonomy term.";
    

    To save the node – if the node is new:

    node_submit($node);
    node_save($node);
    

    or, to save the node if it’s an existing node:

    node_save($node);
    

    In Drupal 7, terms are attached as normal field items so field_first_name[0] means the first occurrence of the field. Don’t confuse that functionality with terms. You can add as many as terms you want.

    Update: Thanks to kliker for the edit, which was unfortunately rejected. It seems I have to edit the post myself to get his changed into this answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have ios application with xcdatamodeld, i want update some data so need a
I have an XML file. I want to update (add some nodes) to it.
Guess that I have a TextView that I want to update it in some
I have a dataset with some 30 records in it. I want to update
I want to update some file in a server, with an automated script and
I want to update a table to indicate that some rows are parents of
When I want to update the eclipse I get the following error: Some sites
I would appreciate some help with an UPDATE statement. I want to update tblOrderHead
I want to interrupt some specific grails domain class events(read,write,delete,update).Is there any hibernate eventlistner
I'm using Views for some nodes, and I want to display a different View

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.