WordPress 不在管理员中显示评论

Wordpress not showing comments in admin

在此 Wordpress 安装中,评论未显示在管理部分。 我使用 wp_insert_comment() 函数添加评论,并使用来自自定义 post 类型的 post ID。在自定义 post 类型中,支持设置为接受评论。

在自定义 post 类型的编辑页面上,我看到评论的计数气球(见屏幕截图 1),当我点击气球时,我进入管理中的评论页面并看到该页面的评论非常完美(屏幕截图 2)。但是当我直接进入评论部分时,它说没有评论(屏幕截图 3)。评论按钮上的计数也有效..(屏幕截图 4)

我试过修改评论码,还是不行。

编码我如何添加评论:

$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' );

我发现了问题。我更改了 WPML 设置并且它起作用了..

我能够通过在 wpml 中将 post 类型从“不可翻译”更改为“可翻译 - 仅显示已翻译的项目”来解决问题。