• I am having the hardest time figuring this out, and I’ve already posted a couple times on here with no responses and also on some other sites and still not one response : [

    I have a plugin. I have my own function that reads a CSV file and creates content automatically from the data. All works wonderful.

    However, I would like two columns, namely the ‘category’ and ‘subcategory’ columns of the csv file, to be used to add terms to the custom taxonomy I have created.

    Within the working loop using wp_insert_post() to add these posts from the CSV file. I am also calling wp_insert_term()… However, this function will not work in my plugin anywhere except for the function I have hooked to the init() action…

    Basically it seems wp_insert_term will not work unless it is in the init hook. Why is this? I can’t use a loop to a) check if the term exists, b) if not create the term, c) return the value of the term whether it exists or was just created, d) assign the post_category parameter to the value of the term id so the post uses the correct term…

    Why does this not work? I am still new to wordpress so perhaps there is something I am missing or don’t understand? Everything else I have done has worked fine however, so I feel the answer to my question may not be immediately apparent…

    Any help will be greatly appreciated!

  • The topic ‘Someone please help!!!’ is closed to new replies.