I’m using a form to create posts. Before the redirect i’m updating the post_name and including the post ID at the end. The code below is almost working. It’s creating a post name like
post_name-48so I got the post ID there but why isn’t post_name displaying as the post name and only as a string. I pieced together the function below the best I could and help is appreciated. Thanks
// Update post slug $my_post['ID'] = $pid; $my_post_name = 'post_name' . "-" . $pid; $my_post['post_name'] = $my_post_name; // Update the post into the database wp_update_post( $my_post );
- The topic ‘Updating post_name to include post ID almost got it but need help’ is closed to new replies.