Timeline for Wordpress custom field sorting, weird behavior: the latest post is at the end
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 20, 2015 at 10:51 | vote | accept | Gasim | ||
Dec 17, 2015 at 15:13 | comment | added | Pieter Goosen |
@N00b The date format is correct, custom fields are sorted literally so it should not make a difference if all your dates are saved as Ymd , Y-m-d or Y/m/d . What does matter is that you cannot have a mix. so you cannot have some dates as Ymd and others as Y-m-d
|
|
Dec 17, 2015 at 15:12 | answer | added | Gasim | timeline score: 0 | |
Dec 17, 2015 at 14:59 | answer | added | N00b | timeline score: 0 | |
Dec 17, 2015 at 14:55 | comment | added | Gasim | I checked all the meta keys and everything is fine in the database. I even wrote a query to sort all the posts based on the meta keys using SQL; and the result worked. However, wp_query doesn't work. This problem does not make any sense because for some reason the post that is created today is shown at the very end while all other posts with random orders shows it correctly... | |
Dec 17, 2015 at 14:49 | history | edited | Gasim | CC BY-SA 3.0 |
added 115 characters in body
|
Dec 17, 2015 at 14:47 | comment | added | N00b |
1. Update your question with fixes 2. Make sure all meta_key 's are updated and everything is correct in database 3. Safest date format for code is yyyymmdd without any dots and dashes. You can format it to something beautiful before showing it in front-end
|
|
Dec 17, 2015 at 14:38 | comment | added | Gasim | I changed the event type but the result is still the same. For some reason, the newest post is not being sorted | |
Dec 17, 2015 at 14:14 | comment | added | N00b |
date is your custom field right? I pretty sure that date is already "taken" and is used as one of WP_Query's default fields. (ref: WP_Query) Change your meta_key in database to somethink like event_date or even better: {your or your company creds}_event_date like rs_event_date . This way it never conflicts with default WP phrases.
|
|
Dec 17, 2015 at 12:10 | history | asked | Gasim | CC BY-SA 3.0 |