Fixing pending comments issue

General

WordPress comments are very reliable and it is very rare that you’ll ever see this issue on your site. But just like with all technology, things sometimes fail and then you need to debug and correct them. I searched internet and found nothing. Hopefully, some of you will find this post useful.

Scratch To Unity: Control
Thursday July 25, 2019

This post provides a handy reference guide to go from Scratch’s “Control” category of code blocks to C# with Unity. Code Blocks Click on the picture of any of these Scratch code blocks to see how to write similar code statements in C#. IEnumerator Start() { // Optional code here yield return new WaitForSeconds(1f); // […]

The post Scratch To Unity: Control appeared first on Dua xe moto.

So, one day all of a sudden I find that I have 24 pending comments in my WordPress admin dashboard comments panel and when I click on pending comments link it shows no comments.

German Language Course Visa
Tuesday October 23, 2018

You need a German language course visa if you’ve been confirmed as a participant in a non-academic German language course, lasting 3-12 months, covering at least 18 hours of lessons each week. This course shouldn’t be predestined to prepare you for further university studies in Germany. A German language course visa is valid initially for […]

The post German Language Course Visa appeared first on Dua xe moto.

I realised that people were commenting but getting the error.
 

So, first I tried to optimise database which did not work. Then I started debugging code, the error message appears from wp-includes/comments.php which runs the function wp_new_comment which runs the function wp_insert_comment  which runs $wpdb->insert in wp-includes/wp-db.php which runs the function _insert_replace_helper and in this function I got the generated sql file. I printed the sql query [ print_r($this->prepare( $sql, $values ) ) ] and ran the query directly in the database. Then I found that the query was running but the comment_ID was generated as 0.

So, it was a database issue, when I edited the structure of the wp_comments table, I found that comment_ID was neither set as primary key, not it was set on auto increment mode.

Scratch To Unity: Sensing
Thursday July 25, 2019

This post provides a handy reference guide to go from Scratch’s “Sensing” category of code blocks to C# with Unity. Code Blocks Click on the picture of any of these Scratch code blocks to see how to write similar code statements in C#. void OnMouseOver() { // Code to run when mouse is touching } […]

The post Scratch To Unity: Sensing appeared first on Dua xe moto.

The fix was to remove all the comments with comment_ID as 0 and then setting the comment_ID as primary key and auto-increment.

Finally comments were back on my site.

The post Fixing pending comments issue appeared first on VibeThemes.