[resolved] WP 2.3.3 Comments Feed Database Error: AND comment_approved = '1' ORDER BY... (2 posts)

  1. christophdollis
    Posted 8 years ago #

    Googling this:

    AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 10

    ... nets 10 pages of error messages and counting so this is a widespread problem.

    For my blog's comment feed, it generates this VISUAL error:

    XML Parsing Error: junk after document element
    Location: http://christophdollis.com/blog/comments/feed
    Line Number 4, Column 9:		</div><?xml version="1.0" encoding="UTF-8"?>

    Viewing the source, I see:

    <div id='error'>
    		<p class='wpdberror'><strong>WordPress database error:</strong> [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 10' at line 1]<br />
    		<code>SELECT wp_comments.* FROM wp_comments  WHERE comment_post_ID =  AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 10</code></p>
    		</div><?xml version="1.0" encoding="UTF-8"?>
    <!-- generator="wordpress/2.3.3" -->
    <rss version="2.0"

    Deactivating all plugins and ensuring Gzip compression was turned off didn't help. Changing the theme to either the default or classic theme didn't help. Changing the theme and turning off all plugins didn't work.

    I'm stumped. Lots of people are having this problem. Can you help me?

    - Christoph


  2. christophdollis
    Posted 8 years ago #

    In my case the resolution was pretty simple so if you're having this exact problem, please listen up.

    I publish my blog posts using custom permalinks in the format:


    ... where /blog is just what I entered into the custom permalink field. It's also where my WordPress install is in Options > General...

    WordPress address (URL): http://christophdollis.com/blog
    Blog address (URL): http://christophdollis.com

    And when I go to Options > Reading...

    [selected] Front page displays: A static page (select below)
          Front page: MY SITE HOME PAGE
          Posts page: MY MAIN BLOG PAGE

    This is the important bit... in reality, my feed is located at:








    ... like it used to be before I changed permalink structure and created a separate site home page.

    So if you have this common error and you have your site home page separate from your blog posts home page, this may be the cause. Double check you're drawing your feed from the correct URL.

Topic Closed

This topic has been closed to new replies.

About this Topic