WordPress database error from graphene_get_comment_count()

  • JD

    #7639

    I am getting the following error logged each time I visit the administration side of the site:

    [23-Jun-2013 21:12:19 UTC] WordPress 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 7 for query
    SELECT
    COUNT(comment_ID)
    FROM
    ds_comments
    WHERE
    comment_type = "" AND comment_approved="1" AND comment_parent="0" AND
    comment_post_ID= made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/graphene/404.php'), get_header, locate_template, load_template, require_once('/themes/graphene/header.php'), wp_head, do_action('wp_head'), call_user_func_array, wp_enqueue_scripts, do_action('wp_enqueue_scripts'), call_user_func_array, graphene_localize_scripts, graphene_get_comment_count

    I think this is happening because graphene_get_comment_count() uses get_post_ID(), which probably won’t work on the admin side. I only get this error on the Dashboard screen, so I think maybe it is related to showing the comment count in the Right Now widget. Is this a known issue?

    Thanks.

    Admin

    Syahir Hakim

    #38844

    Try adding this code to the top of the graphene_get_comment_count() function and see if the error is still showing up:

    if ( ! get_the_ID() ) return;

Viewing 2 posts - 1 through 2 (of 2 total)

  • You must be logged in to reply to this topic.