WordPress.org

Ready to get started?Download WordPress

Forums

Database error in post preview. (3 posts)

  1. notRyan
    Member
    Posted 9 years ago #

    My blog looks fine and the post content is fine except I noticed that when going to "Edit" on a post an seeing the post preview at the bottom I get an error above the post:
    Database error: [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 '' at line 1]
    SELECT post_content FROM wp_posts WHERE id=
    This doesn't really affect the blog, but it just annoys me when there's an error on the site. :P Can anybody help me find the source of this problem and/or how to fix it? Thanks!
    -Ryan

  2. planetthoughtful
    Member
    Posted 9 years ago #

    Hi Ryan,
    At a quick guess I'd suggest it's a plugin you have that isn't being supplied a variable it expects in an SQL string when on the edit page, but is when the posts are being viewed.
    First step is to diagnose which plugin, if that is the problem.
    Deactivate, one by one, each of your active plugins, and see if the error message disappears.
    If it disappears when a particular plugin is deactivated, we're closer to working out how to fix the problem in particular.
    Let us know how you go.
    Much warmth,
    planetthoughtful

  3. Mark (podz)
    Support Maven
    Posted 9 years ago #

    It's the word/image count plugin.
    I noticed this a few days ago and with some help here from Mark Jacquith, tracked it down.
    It's the plugin by Chuck G.
    I mailed him and his fix is below:
    "Around line 102, you should see:
    add_filter('the_content', 'add_post_counts');
    Change this to:
    if (!strpos($_SERVER['SCRIPT_NAME'], "/wp-admin/"))
    { add_filter('the_content', 'add_post_counts'); }
    All this is doing is forcing the plugin not to run, or be applied when
    you're looking a the site through the admin panel."
    Works just fine :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.