• Hi Everyone,

    I have the following problem:

    I have written a plugin which adds a custom post type with a custom toxonomy to my wordpress site. The plugin runs a cronjob every 10 minutes. When the cronjob is executed, data is fetched from a remote server. A part of the data contains terms that have to be associated with my custom post type. So i want to insert them as term in my custom taxonomy for my custom post type.

    I tried to use wp_insert_term(), however after calling it nothing seems to be inserted. Did anyone face this problem aswell? and how did you solve it?

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • I think I can help you. I did some inserting into the WordPress database and learned a few things. I didn’t use custom taxonomies but I thing it is close enough to what you’re doing.

    First of all – you’re saying that nothing seems to be inserted. Well, you need to be sure. If the data is added to the database and you can’t see the results on your website then the problem is that you’re missing something. When I tried to insert some CPTs into WordPress and assign categories, the categories wouldn’t show on my site because I didn’t increment the term_taxonomy_id in wp_term_taxonomy table.

    But if there is no data inserted, there may be a problem with your connection to the remote server. Check the password. ??

    Try to read this topic. It gets interesting around post 6 or 7. You may find that using wp_insert_term() isn’t very efficient.

Viewing 1 replies (of 1 total)
  • The topic ‘Cannot insert terms’ is closed to new replies.