Created
February 22, 2021 10:39
-
-
Save Prroffessorr/593285e3f901178492c028c56f34f428 to your computer and use it in GitHub Desktop.
Генерация комментариев в WordPress (Если нужно создать несколько комментариев автоматически)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$comments = get_comments(); | |
$data = [ | |
'comment_post_ID' => 1, | |
'comment_author' => 'admin', | |
'comment_author_email' => 'admin@admin.com', | |
'comment_author_url' => 'http://', | |
'comment_content' => 'content here', | |
'comment_type' => 'comment', | |
'comment_parent' => 0, | |
'user_id' => 1, | |
'comment_author_IP' => '127.0.0.1', | |
'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', | |
'comment_date' => null, // получим current_time('mysql') | |
'comment_approved' => 1, | |
]; | |
wp_insert_comment( wp_slash($data) ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment