Support

Account

Home Forums General Issues Order by custom field not working Reply To: Order by custom field not working

  • Correction, I pasted in the wrong query above.

    The query

    
    select
    	p.ID,
    	p.post_title, 
    	pm.meta_value
    from wp_posts p
    inner join wp_postmeta pm on pm.post_id = p.ID
    where pm.meta_key = 'campaign_end_date'
    and p.post_status = 'publish'
    order by pm.meta_value asc
    

    The data

    
    257867	Barbaric	20220906
    257863	River Trek	20220909
    257396	Comic Book Bubble	20220913
    257405	Sea of Legends: Vengeance of the Empires	20220915
    257873	RoboMon	20220916
    257398	Trailblazers	20220916
    257865	Full Sun	20220917
    257864	Bakufu: A Japanese Themed Strategic Card Game	20220920
    257866	Diamond Dig	20220920
    257874	Honey	20220920
    257406	Almost Innocent	20220920
    257868	Dwar7s Legendary Forest	20220921
    257404	Kinfire Chronicles: Nights Fall	20220921
    257403	CobbleCritters	20220922
    257869	The FOG - Escape from Paradise	20220922
    257862	Weavlings in the Wilds	20220929