post_name is not stored until post is published... where should I store my slug until it goes live then?
important try as normal contributor user, not as admin
see here I actually have it reproduced. Seems like a bug to me but whatever. I want users to choose their slug. Well, as you cannot store post_name in pending posts, where should I store it? where does wordpress store the slug the user chooses while it is still draft / pending?
EDIT
my code, this works as it is publish status:
$post_information = array(
'post_title' = 'Your title',
'post_content' = 'blabla',
'post_type' = 'post',
'post_author' = wp_get_current_user()-ID,
'post_status' = 'publish',
'post_name' = "somerandomstuffthatisunique222"
);
$new_id = wp_insert_post( $post_information);
$postl = get_post($new_id);
this does not work
$post_information = array(
'post_title' = 'Your title',
'post_content' = 'blabla',
'post_type' = 'post',
'post_author' = wp_get_current_user()-ID,
'post_status' = 'pending',
'post_name' = "somerandomstuffthatisunique2223434343434"
);
$new_id = wp_insert_post( $post_information);
in case 2, post_name is empty string after insert.
the author doesn't matter