• 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)
  • 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.