Search code examples
phpwordpressthemescomments

Wordpress not showing comments in admin


In this Wordpress installation the comments are not showed in the admin section. I add the comments with the wp_insert_comment() function, with a post ID from a custom post type. In the custom post type the support is set to accept comments.

On the custom post type edit page, I see the count balloons for the comments (See screenshot 1), and when I click on the balloon I go to the comment page in the admin and see the comments for that page perfectly (screenshot 2). But when I go directly to the comment section it says No comments (screenshot 3). Also the count at the comment button does work..(screenshot 4)

I tried modifying the comment code, but still it does not work.

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4

Code how I add the comment:

$data = array(
                    'comment_post_ID' => HERE COMES THE ID FROM THE POST (CUSTOM POST TYPE),
                    'comment_author' => HERE COMES THE AUTHOR NAME,
                    'comment_author_email' => HERE COMES AUTHOR EMAIL,
                    'comment_author_url' => '',
                    'comment_content' => get_the_title($id).' heeft sollicitatie gedaan op '. $time,
                    'comment_type' => '',
                    'comment_parent' => '',
                    'comment_author_IP' => $_SERVER['REMOTE_ADDR'],
                    'comment_agent' => '',
                    'comment_date' => $time
                );

                $comment_id = wp_insert_comment($data);

                wp_set_comment_status( $comment_id, 'hold' );

Solution

  • I found the issue. I changed the WPML settings and it worked..