Redirect on publish_post action hook
-
I’m writing a plugin that integrates WP with another application… it’s nearly complete but I need one last little line of code worked out.
I have an action hook on “publish_post” that runs some db lookups and some logic then it generates a url and I want it to open that url either in the current window or a new window (it doesn’t matter).
using
wp_redirect($url);
doesn’t do anythingneither does
header("Location: $url");
and neither does
header("Refresh: 0;url=$url");
the only thing that will open my url in a new window is this:
echo '<script type="text/javascript">window.open(\''.$url.'\')</script>';
doing that will open my page in a new window, but the current page (the WP post editor) will crash with the following message:
Warning: Cannot modify header information – headers already sent by (output started at
/serverurl/wp-content/plugins/wp_smf_commenter/wp_smf_commenter.php:73) in
/serverurl/wp-includes/pluggable.php on line 275where serverurl is the complete path on my server and wp_smf_commenter is the name of my plugin.
line 73 is the javascript line above.I really really really don’t want to use javascript. Does anyone have any suggestions?
- The topic ‘Redirect on publish_post action hook’ is closed to new replies.