-1
I am creating a snippet to add a product in wordpress. But I realized that it is not enough to insert the product in the wp_posts table. The query works, the item is inserted in the database, but the product is not displayed in the product screen.
<?php
$connect = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$sql = "INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (49, 1, '2019-07-31 11:15:10', '2019-07-31 11:15:10', 'texto_sql_diff', 'novidadediff', 'texto_sql_desc', 'publish', 'open', 'closed', '', 'novidadediff', '', '', '2019-07-31 11:15:14', '2019-07-31 11:15:14', '', 0, 'http://duffplugin.atwebpages.com/?post_type=product&p=48', 0, 'product', '', 0)";
if ($connect->query($sql) === TRUE) {
echo "<script>console.log('tudo OK!)</script>";
} else {
echo "Error " . $sql . ' ' . $connect->connect_error;
}
$connect->close();
?>