こんにちは、すべての幸せな祝日! :)Wordpressはwp_insert_comment()経由でコメントを挿入します
私はwp_insert_comment()
機能を介してWordPressのブログにコメントを挿入しようとしています。それは私が作ろうとしているプラグイン用です。
私はテストのために私のヘッダーにこのコードを書いています。私はページを更新するたびに動作します。
$agent = $_SERVER['HTTP_USER_AGENT'];
$data = array(
'comment_post_ID' => 256,
'comment_author' => 'Dave',
'comment_author_email' => '[email protected]',
'comment_author_url' => 'http://www.someiste.com',
'comment_content' => 'Lorem ipsum dolor sit amet...',
'comment_author_IP' => '127.3.1.1',
'comment_agent' => $agent,
'comment_date' => date('Y-m-d H:i:s'),
'comment_date_gmt' => date('Y-m-d H:i:s'),
'comment_approved' => 1,
);
$comment_id = wp_insert_comment($data);
コメントをデータベースに挿入します。
問題:コメントはDisqusコメントシステムでは表示されません。私はテーブルの行を比較し、私はuser_agentが違うことに気づいた。
通常のコメントはMozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv...
、例えば使用し、ディスカスのコメントはDisqus/1.1(2.61):119598902
番号を使用するには、各コメントのために異なっています。
Disqusが有効になっているときにwp_insert_comment()
とコメントを挿入する方法を知っている人はいますか?