Skip Navigation

[Résolu] Taxonomies and Relationships

This support ticket is created Il y a 5 années. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Christian Cox Il y a 5 années.

Assisté par: Christian Cox.

Auteur
Publications
#1379181

Tell us what you are trying to do?
I have three CPT, Employers, Employees, Job Listings. Employers to Employees and Employers to Job Listings both have one to many relationships. Employees to Job Listings have a many to many relationship.

I also have a custom taxonomy, Industries, that is assigned to each CPT. I'm trying to figure out if I'd be able to carry over the industry Taxonomy to the different post types. For example, if I add an Employee to the Technology Industry, is there a way for the related Employer to be added to the Technology Industry automatically?

#1379463

Hi, nothing automatic in Toolset like this, unfortunately. However, with a bit of custom code you could accomplish something similar. You would need to use the save_post hook, wp_get_object_terms, wp_set_object_terms, and the Toolset Post Relationships API to query related posts:
https://developer.wordpress.org/reference/hooks/save_post/
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/
https://developer.wordpress.org/reference/functions/wp_get_object_terms/
https://developer.wordpress.org/reference/functions/wp_set_object_terms/

This ticket is the closest thing I have found on the site that does something similar with custom code, but it's designed for WordPress hierarchical posts instead of Toolset's post relationships:
https://toolset.com/forums/topic/when-child-term-is-set-automatically-set-parent-term-of-that-child/

I'm available to assist with any Toolset API if you have some code you would like to collaborate on, not sure of your skill level with PHP and whether or not this is something you want to take on.