Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress create comment programmatically

$data = [
    'comment_post_ID' => 19,
    'comment_author' => 'Dave',
    'comment_author_email' => 'dave@domain.com',
    '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);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel where 2 column 
Php :: wp change num words exerpct 
Php :: how simple get ip address json 
Php :: job execute async laravel 
Php :: livewire call function from other component 
Php :: mysql Cannot pass parameter 2 by reference 
Php :: laravel module package 
Php :: get node url from id twig 
Php :: route() and with() in laravel 
Php :: laravel collection search 
Php :: laravel 6 make http request 
Php :: How to display custom field in wordpress? 
Php :: explode return empty array 
Php :: ajax search request 
Php :: Getting the closest string match using php 
Php :: laravel eloquent duplicate record 
Php :: PDO encode result recordset to utf8 
Php :: php pdo example 
Php :: php key_exists 
Php :: laravel get route path uri 
Php :: getimagesize php 
Php :: php switch case greater than 
Php :: how to get array key in php 
Php :: laravel pdf export 
Php :: laravel collection last 
Php :: laravel manually authenticate user 
Php :: eloquent insert into select 
Php :: php convert string to array 
Php :: clear cache without using composer in laravel 8 
Php :: php switch case statement 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =