Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

After an WP_insert_posts array has been executed how do I then redirect the browser to that post.

Many Thanks,

share|improve this question

1 Answer 1

Try the following:

$post_id = wp_insert_post( array( 'your', 'args', 'here' ) );

$link = get_permalink( $post_id );

wp_redirect( $link );

die();
share|improve this answer
2  
Also need to die() right after wp_redirect(). –  Rarst Feb 8 '11 at 6:26
    
Warning: Cannot modify header information - headers already sent by (output started at .......... Zack I think it is not working because we are not using the $post_id. we are using $the_post_id thanks to your brilliant script from a few days ago. wordpress.stackexchange.com/questions/8569/… –  Robin I Knight Feb 8 '11 at 10:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.