WordPress Utwórz komentarz programowo
$data = [
'comment_post_ID' => 19,
'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' => $_SERVER['REMOTE_ADDR'],
'comment_agent' => $_SERVER['HTTP_USER_AGENT'],
'comment_type' => '',
'comment_date' => date('Y-m-d H:i:s'),
'comment_date_gmt' => date('Y-m-d H:i:s'),
'comment_approved' => 1,
'comment_parent' => 2, //add field if this comment is a reply
];
$comment_id = wp_insert_comment($data);
Ivan Cuaco