wp_insert_term() Help (2 posts)

  1. Yojance Rabelo
    Posted 5 years ago #

    Hi everyone, I need some help with wp_insert_term(), its not doing what I think should be doing.

    I created a custom post type called car_listings and then added a taxonomy to it:

    register_taxonomy('car_cylinders', 'car_listings', $args);

    I'm now trying to do the following without success:

    wp_insert_term('4', 'car_cylinders');

    Am I jumping steps here? I think that's the correct way of doing it because I don't need to set a parent or anything, just add 4 the car_cylinders taxonomy.

    Can anyone help me? Thanks.

  2. Yojance Rabelo
    Posted 5 years ago #

    I turn the code into a function and then added the function to init and it worked. The problem I'm having now is that when I try to delete it through the back-end, it doesn't let me.

    I wonder if it has anything to do with me working on my localhost.
    Any suggestions?

Topic Closed

This topic has been closed to new replies.

About this Topic