Last Updated: February 25, 2016
·
1.644K
· felipelavinz

WordPress: get_post_meta() returns results in random order

Quick and to the point:

  1. The function that queries meta-data doen't have an ORDER BY
  2. MyISAM tables change the order of data when updated
  3. Switch to InnoDB, so all queries without "ORDER BY" are sorted by primary key and your results will be always in the same order :-)

...btw, this bug is reported and should be fixed in WordPress 3.8

léelo en español en: http://www.yukei.net/2013/11/wordpress-get_post_meta-devuelve-resultados-en-orden-aleatorio/