Title: wp_insert_post Redirection
Last modified: August 20, 2016

---

# wp_insert_post Redirection

 *  [tiredofit](https://wordpress.org/support/users/tiredofit/)
 * (@tiredofit)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wp_insert_post-redirection/)
 * I have a Multisite Installation where I want to create a Page for a user if they
   have a certain option set in their site options.
 * What I would like it to do with the wp_insert_post command is to set it to 302
   redirect to a different URL. I could easiy do this with the nav_menu command 
   however I am not using the WP3 Nav Menus.
 * Is this possible?

Viewing 1 replies (of 1 total)

 *  [Thomas Griffin](https://wordpress.org/support/users/griffinjt/)
 * (@griffinjt)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wp_insert_post-redirection/#post-2555580)
 * As long as you process `wp_insert_post()` before any headers are sent, you can
   use `wp_redirect( $location, 302 )` to redirect your user. Make sure you exit
   directly after the redirect.
 * Since this would be processed if they had an option set in their site, that probably
   means they will be submitting a $_POST form, so you can check to see if that 
   particular var is set and then process it from there.
 * I think you can process the redirect early within the `admin_init` hook (like
   a priority of 0), but if not then, you could do it earlier if you wanted (e.g.
   init).

Viewing 1 replies (of 1 total)

The topic ‘wp_insert_post Redirection’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [Thomas Griffin](https://wordpress.org/support/users/griffinjt/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/wp_insert_post-redirection/#post-2555580)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
