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

  • Home
  • SEARCH
  • 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 950663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:36:13+00:00 2026-05-15T23:36:13+00:00

I am creating a module that needs to tag nodes with taxonomy terms when

  • 0

I am creating a module that needs to tag nodes with taxonomy terms when they are created. I have implemented hook_nodeapi() to do this, and am trying to add the term in there like so:

function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'insert':
      $node->taxonomy = array(1 => taxonomy_get_term(1));
      node_save($node);
    break;
  }
}

When I call node_save(), the code just goes in to a loop, because node_save calls hook_nodeapi(). When I don’t call node_save, nothing is saved. I am durned if I do, durned if I don’t. Any ideas on the right way to do thi?

  • 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-05-15T23:36:14+00:00Added an answer on May 15, 2026 at 11:36 pm

    You could use $op="presave" to alter the taxonomy in the way you want and then let the taxonomy module save the terms for you. No need to use node_save afterwards. In fact node save should be avoided in nodeapi implementations for the reasons you state.

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

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Look at the type of maybe and think what it… May 16, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer std::string is not made to be extended. You could encapsulate… May 16, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer It may be an issue with byte alignment, use pragma.… May 16, 2026 at 10:30 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a Drupal module creating a page via hook_menu(). I am trying to
I'm writing a Drupal module that deals with creating new nodes from CSV files.
this module does a good job at creating a tagcloud block - all good
I am creating sql queries and I have read in one book that when
I'm having some trouble figuring out the best/Djangoic way to do this. I'm creating
Which is better for creating a settings file for Python programs, the built-in module
While creating a simple client for a REST service which I have stubbed out,
I'm creating a process with the System.Diagnostics.Process object that sometimes crashes badly and Windows
I am creating a view like this: UILabel *qty = [[UILabel alloc] initWithFrame:CGRectMake(0, 0,
Is it possible to declare and manage several custom content types inside one module?

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.