Skip Navigation

[Resolved] Use custom field of relationship post in Query Filter

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 3 voices.

Last updated by Minesh 1 year, 3 months ago.

Assisted by: Minesh.

Author
Posts
#2653499

Tell us what you are trying to do?
The site has a CPT of Therapists, and a one to one relationship CPT of Checklist. On the directory listing page for the Therapists, I would like to use a field value from the Checklist as part of the Query Filter, but it's not working. Is there something more I need to do for this to work?

Select items with field:
Publish my listing is a boolean equal to 1 - Therapist CPT field
AND
Name is a string equal to URL_PARAM(wpv-wpcf-name)
AND
Town or City is a string equal to URL_PARAM(wpv-wpcf-town-or-city)
AND
Certified is a boolean equal to 1 - Therapist CPT field
AND
Documentation Verified is a boolean equal to 1 - Checklist CPT field
AND
Filter based on the frontend search filter by State or Territory.

#2653559

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I'm sorry to say that filtering by fields of related posts is not supported. You can only filter by fields (or taxonomies) of the content you are querying.

For it to work you would essentially need to duplicate the field from the Checklist post type on the relevant Therapist posts.

#2653887

That's unfortunate, but thanks.
Is there an easy way to have the fields between the 2 posts synchronise whenever one is changed?

#2653941

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I would like to know do you have frontend filters added to your Therapists directory listing page?

Can you please share Therapists directory listing page URL as well as admin access details and let me review what best possible option we can have.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2653945

Thanks, I think I will rework the way the Posts are created and move the data from one into the other. But I was just curious what options there are for dealing with this in the future when that isn't possible.

And yes, there are front end filters on the listing page.
thanks

#2653951

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I can offer you workaround by adding the filter hook "wpv_filter_query_post_process":
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process

If you share admin access details let me try to add that and you can see if you get expected results otherwise you should opt the way to copy the data of post type to each other. Does that makes sense? If yes:

I need problem URL where you added your view and admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2654263

Thank you for your help and workaround offer. For this instance I will just adjust the post field setup.