Is there any way to add a custom URL to the wp_insert_post
function?
$my_post = array(
'post_title' => wp_strip_all_tags( $_POST['post_title'] ),
'post_content' => $_POST['post_content'],
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array( 8,39 )
);
wp_insert_post( $my_post );
post slug
, then usepost_name
parameter.