"Exlcude" Plugins cause posts to display in wrong order (7 posts)

  1. KaseyS
    Posted 3 years ago #

    After upgrading WP a few months ago on one blog - I discovered that it caused posts to display in the wrong order - oldest to newest.

    After deactivating plugins I found that when the plugin Simply Exclude was turned off, posts returned to normal order.

    The author of the plugin was never able to help. So I've been avoiding updating WP on any blogs until today, and unfortunately the problem is still there with WP 3.2.1

    I've also tried two other similar plugins - Ultimate Category Excluder and Front Page Category - both cause the same issue when activated.

    Any thoughts? I really need the ability to keep some content off of the front page.

  2. Paul Menard
    Posted 3 years ago #

    I've had the issue of wrong ordering come up probably a dozen times over the hundreds of users. I have personally not been able to reproduce the issue in any environment available to me. One poster a few months ago was able to dig into his own server configurations. He is is findings:

    "Basically we ran MySQL version 5.0.51a which is known for having a bug with ORDER BY and GROUP BY. I've just upgraded to MySQL 5.1, and the order of posts is now correct while running SimplyExclude."

    As the author of the Simply Exclude plugin I can tell you the plugin doesn't apply any ordering logic nor does it directly build queries. Well it does for Pages which is very old code. But for Posts Categories, Post Tags, etc., all the plugin does is apply filters to the query.

    Supposed you have 20 post categories and two of these categories you want to hide from the home post listing. The excluded categories has Id 26, 99. To exclude that category from your home post listing you simply use the following code.

    function myHomePostsFilter($query)
    if ($query->is_home)
    // See Codes for wp_query http://codex.wordpress.org/Class_Reference/WP_Query
    return $query;

  3. KaseyS
    Posted 3 years ago #

    Thanks for the advice Peter.

    We did upgrade MySql, but that didn't seem to do the trick either.

    I'm sure it's not the plugin(s) causing the issue as well.

  4. KaseyS
    Posted 3 years ago #

    Sorry Paul (not Peter).

  5. Paul Menard
    Posted 3 years ago #

    No worries. Ok. Some followup questions:

    1. Have you tried cloning your site to a local system using MAMP or some other LAMP stack to see if this issue is repeatable? Thinking this would remove the variable of the server configuration. In theory if this is code related then cloning the site should reproduce the issue.

    2. In my initial reply, I provided the simple function to add to your theme's functions.php file. Have you tried deactivated the Simply Exclude plugin and try adding that function? Note you will need to update the category IDs.

    3. If all else fails any chance at getting access to your system. Or maybe easier would you be willing to add some debug code to your site to output information that might help narrow this issue down?

    Let me know.

  6. KaseyS
    Posted 3 years ago #

    Haven't tried Number 1.

    Did try number 2. Did change the Category IDs. Put the function in custom_functions.php since that is apparently what is required for the Thesis theme. However, it didn't seem to have any effect.

    I'm having someone with more experience with PHP look into it as well.

    We also updated MySql, which seemed to be the problem for others with this issue running the version we were using.

    Our other thought is that it's a problem between two different plugins. So I've been deactivating other plugins with Simply Exclude activated, but still haven't figured it out.

    Will let you know about No. 3.

    Thanks for helping.

  7. Paul Menard
    Posted 3 years ago #


    Yeah, that was going to be what my advice would be. I would like to add some debug code which dumps the wp_query on the home page. This wp_query object contains all the parameters setup for the actual SQL query as well as the actual SQL query. So would be nice to see what is setting things.

Topic Closed

This topic has been closed to new replies.

About this Topic