简体   繁体   中英

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.

屏幕截图1

屏幕截图2

屏幕截图3

屏幕截图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' );

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM