I am trying to create a page on a site during plugin activation. The code is working without error and the function call returns a post ID, but when i check the list of pages in the admin area there is nothing there. Wordpress is detecting them as if i go to the pages menu item, the number uinder All() has increased, but the number of published pages has not.
$postarr["post_content"] = "[submission_widget]"; $postarr["post_title"] = "Submit Content"; $postarr["post_status"] = "published"; $postarr["post_type"] = "page"; $postarr["post_name"] = sanitize_title("Submit Content"); $postarr["post_date_gmt"] = date('Y-m-d H:i:s', time()); $postarr["post_date"] = date('Y-m-d H:i:s', time()); $postarr["post_modified"] = date('Y-m-d H:i:s', time()); $postarr["post_modified_gmt"] = date('Y-m-d H:i:s', time()); $postid = wp_insert_post($postarr, true); update_post_meta( $postid, '_visibility', 'visible' );
To double check, i went into the posts table in the DB and i can see the post is there. I dont see anything wrong with it, but something is obviously missing. Where am i going wrong?