• Resolved gmorehoudh

    (@gmorehoudh)


    I am practically beside myself at this point. I’m trying to exclude posts with a certain category from feeds (primarily) and the home page (would be nice but less necessary) when a certain GET variable is set. Also tried this with a tag. The tag__not_in and category__not_in functionality appears to be simply NOT WORKING. $query->set(‘cat’, ‘-[id]’) also fails with the exact same symptoms.

    What happens is when I use any of the three methods I’ve tried, many posts disappear even though I only have ONE post that meets the exclusion criteria. I’ve checked that I’m using the right category id. I’ve disabled and deleted all other plugins that would touch categories and such, and commented out my other functions, and nothing works.

    I have a ticket on trac about this: https://trac.www.ads-software.com/ticket/7798

    As far as I can tell I’ve found a bug. Does anyone know different or can help me out? I’m on the verge of hacking a method of exclusion into the several related files in my theme, which is NOT the right or ideal way to do this.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter gmorehoudh

    (@gmorehoudh)

    I’ve partially figured out what is happening here. Posts aren’t actually improperly disappearing. Instead, they are being spit out in an apparently random order, instead of descending by date as they should be. When I scrolled back through all the older entries on the blog’s home page, the posts appeared to be all there but completely in the wrong order, both on the main blog and the feed.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    I can’t find a bug there, so I think that you must be doing something else that’s mucking it up. I have no idea what it could be though.

    Have you tried looking at the actual SQL query being generated?

    In your wp-config.php file, add this line of code to the top:
    define('SAVEQUERIES', true);

    Then, in you can do this to dump all the queries and how long they took:

    if (SAVEQUERIES) {
    global $wpdb;
    echo '<!--\n';
    print_r($wpdb->queries);
    echo '\n--!>';
    }

    Find the query that’s being generated by your code and see what the heck is wrong with it.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    It just hit me: GROUP BY. That’s probably your problem.

    If your posts are appearing in REVERSE ORDER (oldest first), then that’s definitely it.

    Your version of MySQL has a bug:
    https://www.ads-software.com/support/topic/154622

    Thread Starter gmorehoudh

    (@gmorehoudh)

    I find that when I comment out my code, I can affect the display of posts using query_posts() in my theme’s index.php, for example to reverse the sort order and such. If any of my various functions I’ve tried to exclude the category with are enabled, I cannot affect the display of posts with query_posts().

    I’ll try your suggestion and see what I get.

    Thread Starter gmorehoudh

    (@gmorehoudh)

    Oy vey. We are indeed running 5.0.51a-log.

    They’re not appearing exactly in reverse order. It’s -almost- reverse order, generally ascending, but there are some that are randomly sprinkled around.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Note that the current trunk may not exhibit the same issue, as a whole bunch more “GROUP BY” bits were removed yesterday (they were unnecessary due to other changes). The MySQL bug in question is specific to group by queries.

    Thread Starter gmorehoudh

    (@gmorehoudh)

    We’re going to rebuild our stack with MySQL 5.0.67 and see if that helps.

    Thread Starter gmorehoudh

    (@gmorehoudh)

    Upgrading to MySQL 5.0.67 solved this issue for us. It is a bug in MySQL, not WordPress.

    See the trac ticket above and the link Otto42 posted for details. Thanks Otto for all your help.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘what the @#$! is wrong with post filtering?’ is closed to new replies.