WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] "Sorry, no posts matched your criteria" when updating. (12 posts)

  1. Eric Taylor
    Member
    Posted 8 years ago #

    I just recently went to update a friends blog from a old wordpress version (not sure which version maybe 1.5, definantly not 2.*) and eveything worked fine except none of the posts, or pages, show up. I get the following on the main page in the content area

    "Sorry, no posts matched your criteria."

    I know the posts are still their cuz i can access them through the admin panel, but they just aren't being shown on the main page.

    I need to get this up and working again fast. Help greatly appreciated.

  2. Chris_K
    Member
    Posted 8 years ago #

    You're using the old wp-config.php, right? Still pointing to the original database?

    Did you remember to run wp-admin/upgrade.php as part of your upgrade?

  3. Eric Taylor
    Member
    Posted 8 years ago #

    I did both of those. Still nothing is working.

    Site
    http://stgeorgechess.com

  4. Eric Taylor
    Member
    Posted 8 years ago #

    Could this be a database upgrade problem?

  5. ewagoner
    Member
    Posted 8 years ago #

    This just happened to me, upgrading from 2.0 to 2.0.4

    I can access all the posts via the admin section, but all of the public pages display "Sorry, no posts matched your criteria."

  6. ewagoner
    Member
    Posted 8 years ago #

    The problem is in the line

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    in the template's index.php file, but I don't know more yet. I've got a sidebar that shows the previous three posts in a specific category, and that works fine.

  7. ewagoner
    Member
    Posted 8 years ago #

    Rooting around further, I see the SQL being called (for my front page, anyway) is this:

    SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND 0=1 AND post_date_gmt <= '2006-08-10 17:50:59' AND (post_status = "publish" OR post_author = 1 AND post_status != 'draft' AND post_status != 'static') AND post_status != "attachment" GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 20

    Obviously, the where clause "WHERE 1=1 AND 0=1 ..." will always be false. I'm looking through classes.php to find out where the "0=1" is coming from.

  8. ewagoner
    Member
    Posted 8 years ago #

    I fixed the problem by commenting out two lines in wp-includes/classes.php:

    616: $where = apply_filters('posts_where', $where);


    696: $this->posts = apply_filters('the_posts', $this->posts);

    The first line was setting the 1=0 line in the WHERE statement. The second line was turning the array of returned posts into a NULL array (after the first line was fixed).

    I looked through the code and couldn't find out what those two lines were supposed to be doing. Commenting them out returns my pages to normal.

  9. Eric Taylor
    Member
    Posted 8 years ago #

    wow! your right. thts messed up. thx for teh help.

  10. Mike Little
    Member
    Posted 8 years ago #

    Those filters, and the calls to them, exists so that plugins can modify the query before it is run.

    The fact that removing the call to apply the filters fixes your problem, suggests you have a plugin (or possibly a theme) that has installed a filter.

    You should try adding the lines back, so it breaks, then disabling your plugins to see if it fixes it.

    Assuming that happens, enable your plugins one at a time until it breaks. The last one enabled is the culprit.

    Disable the plugin and report the problem to the plugin author.

    If it is not the plugins try switching to the default theme.

  11. ewagoner
    Member
    Posted 8 years ago #

    Ah. It's not a theme (I tried all the defaults as well as my original), so I'll try the plugins. They all worked for 2.0, but maybe one broke by 2.0.4

  12. ewagoner
    Member
    Posted 8 years ago #

    It was the "Adhesive" plugin. Thanks for the pointer!

Topic Closed

This topic has been closed to new replies.

About this Topic