WordPress.org

Forums

get_posts orderby MySQL issue (6 posts)

  1. Anonymous
    Unregistered
    Posted 7 years ago #

    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.

  2. 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

  3. Anonymous
    Unregistered
    Posted 7 years ago #

    ah f@#$!%.

    Cheers for the response.

  4. 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.

  5. Anonymous
    Unregistered
    Posted 7 years ago #

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

  6. richschmidt
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.