Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robneu/11245426 to your computer and use it in GitHub Desktop.
Save robneu/11245426 to your computer and use it in GitHub Desktop.
As of version 2.74, the Disqus plugin has a bug that produces warrning notices when trying to connect to the WordPress database. This should fix the issue.
<?php
// Ignore the <?php tag, it's only here for syntax highlighting.
// This can be found on line 285 of disqus.php
$commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = 'Disqus/1.0:{$comment->id}' LIMIT 1"), ARRAY_A);
<?php
// Ignore the <?php tag, it's only here for syntax highlighting.
// Replace the code on line 285 of disqus.php with the following:
$commentdata = $wpdb->get_row( $wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = 'Disqus/1.0:%d' LIMIT 1", $comment->id ), ARRAY_A );
@robneu
Copy link
Author

robneu commented Apr 24, 2014

If you need more information, you can find a detailed post on this code here: http://wpbacon.com/tutorials/disqus-plugin-php-errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment