WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] “Sorry, no posts matched your criteria” when updating.

[Resolved] “Sorry, no posts matched your criteria” when updating.

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • 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?

    I did both of those. Still nothing is working.

    Site
    http://stgeorgechess.com

    Could this be a database upgrade problem?

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

    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.

    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.

    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.

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

    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.

    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

    It was the “Adhesive” plugin. Thanks for the pointer!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] “Sorry, no posts matched your criteria” when updating.’ is closed to new replies.
Skip to toolbar