• I am getting the following error logged each time I visit the the Dashboard screen on 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

    This is happening because graphene_get_comment_count() uses get_post_ID(), which won’t work on the admin side. Adding this to the top of the function fixes the bug:

    if ( ! get_the_ID() )
          return;

    Thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WordPress database error from graphene_get_comment_count()’ is closed to new replies.