Skip Navigation

[Resolved] creating a custom taxonomy relationship in database

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#479511
Screen Shot 2017-01-18 at 3.19.41 PM.png

I am working in a WP Multisite environment. I have a custom post type set up with 1500 items in it. I am trying to set up a custom taxonomies with specific relationships. I've written a script that:

  • inserts term_id, name, slug to wp_65_terms,
  • inserts term_id, taxonomy, description and count to wp_65_term_taxonomy (term_id from wp_65_terms)
  • inserts object_id, term_taxonomy_id and term_order to wp_65__term_taxonomy (object_id from wp_65_posts, and term_taxonomy_id from wp_65_terms)

(the site I'm working on has the site id of 65, thus the "wp_65_" above)

My script successfully creates new taxonomies, BUT the relationships to the custom post types is not displayed.

Is there another place in the database that controls the display of relationships to taxonomies?

Thank you for your help

(in the attached screenshot, you see the list of taxonomies, but none are selected -- contrary to what I would expect)

#480156

Dear jonathan,

This is a custom codes question, according to our support policy, we don't provide custom codes support:
https://toolset.com/toolset-support-policy/
Wordpress is using database table "wp_term_relationships" to setup the relationship between "posts" and "terms"

I suggest you use wordpress function wp_set_object_terms() to setup terms of each post, see wordpress document:
https://codex.wordpress.org/Function_Reference/wp_set_object_terms
Relates an object (post, link etc) to a term and taxonomy type (tag, category, etc).

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.