When I try to sort a Gallery created through the
[gallery] shortcode by numerical titles I get them sorted in alphabetical order. That means that they are sorted like so:
1, 3, 34, 4, 56, 6, etc.
rather than so:
1, 3, 4, 6, 34, 56, etc.
Doing some research I came across the section of the codex (in
WP_Query) explaining this issue. Apparently, setting the
orderby parameter to
meta_value_num would enable numerical sorting.
[gallery] internally uses
wp-includes/media.php::714), which in turn uses
WP_Query, I thought the same rules would apply.
order_by attribute in the shortcode to
meta_value_num doesn't do the trick. I guess that most likely this is the case because I cannot set up the required
But not only can I not specify the meta key, I don't have one, and I don't need one because I mean to sort them numerically by title.