Recently I updated few of my WordPress plugins to the latest version after core WordPress update. The update was successful but later on I used to get many comments on my different articles and not able to see those comments in my email. So I tried to approve it from my WordPress dashboard but when I tried to approve it , it was always giving me internal server error like below
I thought it’s due to some caching issue at backend so I tried to approve comments from frontend comment system but that also leads to similar error like below when you try to approve and reply to any pending comments.
[box type=”warning” icon=”warning”]Fatal error: Class ‘W3TCstdClass’ not found in /wp-content/plugins/w3-total-cache/Util_PageUrls.php on line 527[/box]
Solution to FIX Comments approving error in WordPress:
If you are coder then the above error clearly indicating issue related with W3TotalCache plugin. I opened Util_PageUrls.php file from Plugins->Editor->W3TC->Util_PageUrls.php and found that ‘/’ is missing in line where its showing an error. So below is a simple solution to fix it.
1. Navigate to wp-content/plugins/w3-total-cache/Util_PageUrls.php either using FTP or WordPress plugin editor.
Look for “$GLOBALS[‘post’] = new stdClass()” which is at line number 527
2. Replace it with $GLOBALS[‘post’] = new stdClass(); & save file.
3. Now approve & reply to all your comments without any error or issue.
Note: Before making any changes we strongly recommend you to take WorpressDataBackup as changing in codes may lead towards downtime of your site.
Let us know in comment section if you still face any problem with it. We are happy to solve it from our end.