Skip Navigation

[Resolved] Why can Date fields have two filter conditions but String fields cannot?

This support ticket is created 3 years, 5 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/Karachi (GMT+05:00)

Author
Posts
#2083301

I want to have three Views of a CPT where each view is sorted alphabetically by Post Title and filtered to group the posts into A-L, M-R, and S-Z. Filtering by only the first character of the post title is not sufficient in this case, as it will result in listing that are not purely alphabetical.

I have other Views where the sorting and filtering is by a Date field, and for those views, selecting a range of dates is simple before the Date field can be selected in a pair of filters, one filtering for 'greater than' a certain date value and the other 'less than' a different date value. Why is that possible for Date fields but not for String fields?

#2083337

I'm totally happy to wait for Christian's availability on this particular ticket!

#2084349

Hi,

Thank you for contacting us.

Christian won't be available before Sunday, so I hope it is fine if I reply to this ticket.

At the database level, the date field values are stored in numerical Unix timestamp format ( ref: hidden link ), whereas the string fields can consist of a combination of numbers, alphabets, or even special characters.

As performing numerical and comparative operations on alphanumeric data can result in unexpected results, they are only offered for the numerical fields.

For what you're planning to achieve the most efficient and simple approach would be registering a new custom taxonomy (let's call it something like "Alphabetical Groups") and add these 3 group names as 3 terms:
1. A-L
2. M-R
3. S-Z

This way you'll not only have full control over which post should belong to which group, but filtering the posts on the front-end using these taxonomy terms will be more efficient in terms of performance too.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2084387

My issue is resolved now. Thank you!