I am trying to insert data into wp_post and wp_postmeta tables but it seems like i am doing something wrong.
Here is my code:
$post_data = array( 'post_title' => $data, 'post_content' => $data, 'post_status' => 'publish', 'post_type' => 'product' ); $id = wp_insert_post($post_data); add_post_meta($id, '_stock', $data); add_post_meta($id, '_price', $data);
The post is inserted as it should but when i check the postmeta table no values had been inserted. I also tried the update_post_meta but still doesn't work.