Order By meta_value works in SQL but not on page?
-
The shortcode I’m using is:
[mla_gallery category_name=parking meta_key="incident_date_time" orderby=meta_value order=DESC mla_alt_shortcode=justified_image_grid]
The SQL query returned with debug=true:
4087 mla_debug request = ' SELECT wp_posts.* FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (24) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND ( wp_postmeta.meta_key = \'incident_date_time\' ) AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\')) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value DESC '
The contents of the db when I manually run that SQL (NB edited to remove the “\” characters) – the meta_data with meta_key value = “incident_date_time” is a plain numeric version of the “post_excerpt” content e.g. 202311161645 and as can be seen, the list is sorted on that date and time as I wanted:
But the displayed page is not shown in that order…
Thanks for any help you can provide ??
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Order By meta_value works in SQL but not on page?’ is closed to new replies.