Hi Beck,
A server redirection using the add_shortcode function will simply never be possible, as you mentioned it there will be always content served before the shortcode function is triggered.
What you should do instead is a javascript redirection but this is not very sexy.
What exactly are you trying to achieve?
Maybe there’s another solution.
Cheers,
Ben
Ok Beck,
If you want it to work with a JS redirection the solution will look like that.
http://pastebin.com/L6xrvN8h
Try it out and let me know how does it go.
Ben
Thread Starter
becskr
(@becskr)
Thanks, after some tinkering I got it to work. Something was wrong previously but now it’s fine!
Hi.
I am having the same problem.
Did you manage to make it work with a shortcode?
If so could you post the solution?
Thanks.
Thread Starter
becskr
(@becskr)
Hi there,
After the wp_insert post add this
return ‘<script type=”text/javascript”>
<!–
window.location = “http://example.com/blahblahblah”
//–>
</script>’;
The problem with this is it’s a bit clunky – it will still half load the form submission page and then redirect after. But that is fine for what I needed.