This support ticket is created Il y a 5 années et 10 mois. 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.
I would like to be sure about searchs.
I have 2 CPT in a relationship ONETOMANY
Exemple : House and room
If i had to search on these 2 CPT. That i have understood is :
- I create a relationship on the field id house or name (example)
- When i search i cannot create search on the 2 CPT on the same time, so i if wanted to search all rooms that are biger than 20 meters and belong to house that is Newyork city, i'd have to make the field city available on room CPT and fill it for each room.
After that, i could search.
Right ?
It is very strange, if we had to do that, it would be really not clean and not appropriate if we have lot of relationships.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Hi there
You are correct in your understanding.
The way WordPress queries the database to retrieve posts, you can only refine the query by specifying properties of the thing you are querying for.
So if you are searching for Room posts, you can only filter the search with properties of Rooms (e.g. size), not with properties of something else (e.g. the "has garage" property of a house).
The user experience expects that, but the underlying database queries are not set up for it.
It is, of course, possible when you start customising the queries (joining database tables or chaining queries), but at the moment the Views queries are built on top of the underlying WordPress queries.
We have a couple of unfinished tickets to complete the many-to-many relationships project, and filter posts by fields of related posts is one of them.