0
Ich versuche, Produktkommentare manuell aus der Datenbank zu schreiben.Wordpress/Woocommerce Kommentar vom Code
$wpdb->insert($table,
array(
"comment_post_ID" => '26475',
"comment_author" => 'text',
"comment_author_email" => "[email protected]",
"comment_author_IP" => "192.168.122.122",
"comment_date" => "2017-09-28 14:53:46",
"comment_date_gmt" => "2017-09-28 10:53:46",
"comment_content" => "Testing Product",
"comment_karma" => "0",
"comment_approved" => "1",
"comment_agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"comment_parent" => "0",
"user_id" => "0",
));
$ListingID = $wpdb->get_var("SELECT comment_ID FROM ". $table ." WHERE comment_post_ID = '26475' AND comment_content = 'Very Good Product'");
$wpdb->insert($table_comment_meta,
array(
"comment_id" => $ListingID,
"meta_key" => "verified",
"meta_value" => "0",
));
// $wpdb->insert($table_comment_meta,
array(
"comment_id" => $ListingID,
"meta_key" => "rating",
"meta_value" => "5",
));
Nachdem ich führen Sie den Code, und gehen Sie auf der Produktseite, den Kommentar und die Bewertung erscheint, aber das Problem, dass ich habe, wo es Bewertungen gezählt bevor sie angezeigt werden, dosen't es diesen Kommentar zählen .
Jemand hat eine Idee, was ich hier vermisse.
Danke, es funktioniert, und ich fand einen anderen Weg. Ändern Sie den Wert von table_comment_meta mit diesem \t add_comment_meta ($ ListingID, 'rating', '5', true); \t wp_update_comment (array ("comment_ID" => $ ListingID, "comment_approved" => 1)); –