Skip Navigation

[Resolved] date field order problem

This thread is resolved. Here is a description of the problem and solution.

Problem:

I used "WP Ultimate CSV Importer" to upload field datas, setup a post view, order by custom date field, and get unexpected results.

Solution:

The problem is in your database table "wp_postmeta", there are lots of "Események" posts, which are using two instances in custom date field "Dátum idő", one of the field value is empty, and it conducts the problem, it seems the problem occurs when you import the CSV files.

You can try to remove those empty values, for example:

https://toolset.com/forums/topic/date-field-order-problem/#post-1685977

Relevant Documentation:

This support ticket is created 4 years, 6 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/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by laszloB 4 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1684337
date_fields.jpg

I am trying to:
view date fields (sort by date field)

Link to a page where the issue can be seen:
hidden link

I expected to see:
good sort order

Instead, I got:
bad sort order

#1684855

Hello,

Thanks for the details, I assume we are talking about a custom date field created with Toolset Types plugin.

I have tried it in a fresh WP installation + the latest version of Toolset plugins, but there isn't the same problem as you mentioned above, please check these:

1) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again

2) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1685949

Thanks for the details, I can download the files, will update here if find anything

#1685977
data-field-order.JPG

The problem is in your database table "wp_postmeta", there are lots of "Események" posts, which are using two field values in custom field "Dátum idő", one of the field value is empty, and it conducts the problem, it seems the problem occurs when you import the CSV files.

You can try these:
Use some mysql tools, for example PHPmyadmin:
1) Backup your website database
2) Run below SQL query:

DELETE FROM `wp_postmeta` WHERE `meta_key` = 'wpcf-datum-ido' AND `meta_value` = ''

Then test again, it works fine in my localhost with your database dump file. see screenshot data-field-order.JPG

Since field "Dátum idő" is a single instance field, you will need to avoid to importing multiple instances in same "Események" post.

#1687431

My issue is resolved now. Thank you!