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.