wp_insert_post ADD post_meta data
-
This is a cutdown version of the code I am using to pull data from a database and insert into WP as a post
<?php require('wp-blog-header.php'); $post_title = $title; $post_status = 'publish'; $post_date= current_time('mysql'); $post_date_gmt= current_time('mysql', 1); $post_author=1; $post_content="Blahblahblah"; $category_slug = $country; $post_category=array($category_ID); $tags_input= array($mytags); $post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status', 'tags_input'); $post_data = add_magic_quotes($post_data); $post_ID = wp_insert_post($post_data); if ( is_wp_error( $post_ID ) ) echo "\n" . $post_ID->get_error_message(); } ?>
My question is…
I now need to populate a custom data field in wp_postmeta
Custom field will be called “photourl” and data held in script as $picurl
Is there an easy way of doing this ?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘wp_insert_post ADD post_meta data’ is closed to new replies.