Custom fields: In what order are they saved into the DB?
The SQL query triggered by get_post_custom() is in update_meta_cache() and it looks like this: $wpdb->get_results( $wpdb->prepare( “SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list)”, $meta_type ), ARRAY_A ); So there is no ORDER BY given. Without ORDER BY the resulting order is almost unpredictable: it depends on the optimizer, used indexes and their … Read more