i tried to generate a page via wp_insert_post. That works fine except that the post_name is always written with the same value as the post_title. Here comes the code snippet:
// Create homesite if not exists
$ins_home = array(
'post_title' => 'Home',
'post_name' => 'my-home-site',
'post_status' => 'publish',
'post_type' => 'page',
'comment_status' => 'closed',
'ping_status' => 'closed'
);
$result = $wpdb->query("SELECT wpost.post_name FROM $wpdb->posts wpost WHERE wpost.post_name = 'my-home-site'");
if($result < 1){// Insert the post into the database
$page_id = wp_insert_post( $ins_home );
}
Any help is very appreciated.
Thanks a lot, Joe