This website is old, and uses a long unsupported theme called Arcade Basic. This means it, like many other prehistoric themes, often breaks in fun and varying ways when I upgrade to a newer WordPress version.
The latest snafu my website ran into upon a recent WordPress upgrade was all my posts were missing comments! Users could still comment and see that there were multiple comments on a post, but the actual comments did not show up.
Luckily, the fix ended up being simple PHP one-liner!
Line 255 of my Arcade Basic theme’s functions.php file defined a function called bavotasan_comment
, which handles the logic for looping through posted comments and populating the comments section.
The switch statement below on line 258 controls the logic to print out the comments. My ancient theme’s function expected an empty string (”) on line 259, but the newer WordPress versions returns a ‘comment’ string.
The fix? Add this ‘comment’ string as a case in the switch statement below the first case in line 259 like so:
switch ( $comment->comment_type ) :
case '' :
case 'comment': //new line
I saved this edit in my functions.php file, and lo and behold, my posts’ comments were back.
This missing case statement causing comments to disappear is not specific to Arcade Basic, and the one-liner fix appears to work for other themes as well: a similar fix was mentioned in a forum thread on disappearing comments for the Mantra theme.
Thank you so much for taking the time to write this blog post!!!! I had a user report this problem today — and I had a sense of what to do because I remembered the issue on the Mantra theme (I participated in that thread you linked to) — but your post saved me the time and trouble of having to hunt through the theme files to find the exact section that needed the fix. I really appreciate your taking the extra time to document the fix for others.
Glad it helped! So good to know that writing up my experience helped someone else,thanks for the note.