[wp-trac] Re: [WordPress Trac] #7431: Allow posts to be ordered by
meta_key
WordPress Trac
wp-trac at lists.automattic.com
Tue Jul 29 19:27:23 GMT 2008
#7431: Allow posts to be ordered by meta_key
-------------------------------------+--------------------------------------
Reporter: AaronCampbell | Owner: anonymous
Type: defect | Status: new
Priority: high | Milestone: 2.6.1
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+--------------------------------------
Comment (by mdawaffe):
+1
You can do this now with the posts_orderby filter.
Also note that if you're trying to sort by numeric data, meta_value is
stored as a string. That means you'll either have to store all your
numeric data in a fixed width format (left pad with zeroes, YYYY-MM-DD,
...) or use the posts_orderby filter (even if the patch gets applied) to
ORDER BY 0 + meta_value (or some similar trick).
--
Ticket URL: <http://trac.wordpress.org/ticket/7431#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list