As known, the blog manager can post posts at a specific time, but what about comments? On this subject I will show you the way

Simply paste this code wherever you want in your template files , Once this code is executed, it will add a new comment to the WordPress database. The value returned is the identity comment ID comment, if you get a problem, change the value 1 to 0.

$ data = array (
	'comment_post_ID' => 1,
	'comment_author' => 'admin',
	'comment_author_email' => 'admin@admin.com',
	'comment_author_url' => 'http://www.catswhocode.com',
	'comment_content' => 'Lorem ipsum dolor sit amet ...',
	'comment_author_IP' => '127.0.0.1',
	'comment_agent' => 'Mozilla / 5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv: 1.9.2.3) Gecko / 20100401 Firefox / 3.6.3'
	'comment_date' => date ('Ymd H: i: s'),
	'comment_date_gmt' => date ('Ymd H: i: s'),
	'comment_approved' => 1,
);

$ comment_id = wp_insert_comment ($ data);

Leave a Reply

Your email address will not be published. Required fields are marked *