• Resolved niznet

    (@niznet)


    Look like orderby title is not sorting properly, what i expected is:

    Chapter 111 [A] (05.04.2018
    Chapter 112 [B] (08.04.2018)
    Chapter 67 [C] (11.06.2018)
    Chapter 66 [D] (09.06.2018)

    and actual is:
    Chapter 67
    Chapter 66
    Chapter 112
    Chapter 111

    Shortcode used:

    [catlist name=mycategory excludeposts=this orderby=title]

    Version
    Wordpress Version: 4.9.6
    PHP Version: 5.6.36

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor zymeth25

    (@zymeth25)

    What you expect is the result of PHP sort(), but alas MySQL produces different results: under the hood WP_Query uses an SQL query for ordering, not PHP functions.

    Plugin Contributor zymeth25

    (@zymeth25)

    One solution could be to edit the slugs of the posts (not the titles) and change them to something with more predictable ordering, then use orderby=name.

    Or you could assign a custom field to each post and then sort by that custom field.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Orderby title is not sorting properly’ is closed to new replies.