WordPress.org

Support

Support » How-To and Troubleshooting » get_posts orderby MySQL issue

get_posts orderby MySQL issue

  • Ive got a problem with the get_posts function not ordering properly.

    Ive had it running fine on my server only to discover there’s a problem when set up on the clients server.

    I found this post http://wordpress.org/support/topic/152353 which includes a hack/fix.

    I went to update the post.php file with the hack but the code doesnt seem to be in there.

    Anyway, as theres no chance of getting MySQL updated on the server anytime soon so i was hoping someone could help me out.

    Much Appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Short answer: You’re screwed.

    Long answer: If your host won’t update to a non-buggy version of MySQL, then switch hosts to one that is responsive to your needs. More recent versions of WordPress fix this problem in every possible place that it can be fixed, so if you’re still getting it, then there’s nothing else that can be done about it short of fixing the database server itself.

    Reference: http://wordpress.org/support/topic/154622

    ah f@#$!%.

    Cheers for the response.

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Note: The error will occur when making queries for specific tags or categories. No way around it, the group by is necessary for those requests.

    But this means that if you don’t request things by category or tag, then you won’t see the problem.

    Thats cool. Im making a request within a category checking for key value pairs. Ill just have to get MySQL updated or switch hosts.

    I’m having a similar issue… but the behavior varies based on the version of WP, not the version of MySQL.

    Both installs are on MySQL 5.0.16, according to phpMyAdmin.
    Both use the same query (a get_posts using “orderby=post_title”).

    The WP 2.2.1 install works perfectly.
    The WP 2.6.2 install has them in post order.

    Ah… Never mind. Apparently post_title is no longer the appropriate parameter name. It took me a while due to the wonky codex search, but I finally found this page & paragraph.

    Now it works. 🙂 I’m leaving the whole post in case someone else has the same problem.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘get_posts orderby MySQL issue’ is closed to new replies.
Skip to toolbar