I am trying to:
Use Parametric Search to show CPT with custom fields. Location field is conditional and only used on some CPT.
Distance Location is used in the search and will show correct results.
However, even when this is not selected with a value, all CPT with no distance data is ignored in the results.
We have CPT "Listings"
This has an option of Course Type with the options for "Location" or "Online"
Location gives the option of "Dates", "Location", "Day Of Week"
This data is only available when Location is selected.
The Parametric Search Filter - Query Filter - Distance is enabled, means results with no location data is ignored.
Link to a page where the issue can be seen:
enlace oculto
I expected to see:
Online and Location results when CPT Custom Field is selected correctly
Instead, I got:
The Parametric Filter removed CPT of items with no location data, even though the location filter hasn't and data selected to be filtered
Hi Stephen
Are you ordering results by location?
The way that WordPress queries work (because of how the underlying MySQL works) is that if you order by some field, and posts which don't have a value for that field will be excluded from the results.
If that's the case, there is no fix or workaround because that's how WordPress works.
You would need to order by some other field.
Hi,
No, they are ordered by post date,
If I put in some dummy data to the field it will show,
It seems like its skipping the post as the field is blank/non-existant.
I could possibly set CRED to default a hidden value, but don't think this is the correct approach to the problem.
Stephen
OK, thanks for clarifying.
Can you also confirm, do you see all the results on the initial page load, and it is only when applying some filter (some other filter, not the distance search) when the posts with no location are omitted?
If that's the case it sounds like a default distance is being applied even when none is selected, and if that's the case I can test that, but would like confirmation first.
Hi,
The form is only shown on the front-page
If you visit the results page directly they are still hidden with no filters selected.
enlace oculto
The single online course I filled with dummy location data shows,
I can't find any reason for the filter to be applied when not selected.
Stephen
OK, well let me test a similar set up locally, and if I can't reproduce the problem I'll ask for a copy of your site.
Actually, this is pretty easy to reproduce, I'm surprised it hasn't come up earlier.
I've escalated this so that my colleagues can investigate further, and I'll let you know as soon as I have some feedback from them.
Hi,
Is there any update on this?
Stephen
Sorry, I don't have any news other than that it will be fixed in the next version of Maps, but I don't have a timescale for when work on that will be finished I'm afraid.
I added a comment to the internal ticket indicating that you are asking about progress.