I am inserting some post into wordpress using the function wp_insert_post().
I want to insert some custom fields on each post and reading the documentation I though the meta_info parameter was used for that, I tried something like this:
$data = array( 'post_author' => 1, 'post_status' => 'publish', 'post_title' => $post->getTitle(), 'post_content' => $post->getContent(), 'post_category' => $post->getCategory(), 'tags_input' => $post->getTags(), 'meta_input' => array( "_test" => "testx1" ) ); $postID = wp_insert_post( $data );
The post gets inserted correctly and tags too. But there are no custom fields added. I know I could use add_post_meta() to add them but I still would like to know what the meta_input parameter is used for, because I did a search on the database for "testx1" after inserting the post and couldn't find any result.