简体   繁体   English

WordPress未在管理员中显示评论

[英]Wordpress not showing comments in admin

In this Wordpress installation the comments are not showed in the admin section. 在此Wordpress安装中,管理部分未显示注释。 I add the comments with the wp_insert_comment() function, with a post ID from a custom post type. 我使用wp_insert_comment()函数添加注释,并使用来自自定义帖子类型的帖子ID。 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). 在自定义帖子类型编辑页面上,我看到了评论的计数气球(请参见屏幕截图1),当我单击气球时,我进入了管理员的评论页面,并完美地看到了该页面的评论(屏幕截图2) 。 But when I go directly to the comment section it says No comments (screenshot 3). 但是,当我直接进入评论部分时,它说没有评论(屏幕截图3)。 Also the count at the comment button does work..(screenshot 4) 注释按钮上的计数也起作用。(屏幕截图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.. 我更改了WPML设置,它开始工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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