I'm trying to redirect the user after they've edited a post using the WordPress Front-end Editor plugin:
Plugin repository http://wordpress.org/plugins/wp-front-end-editor/
GitHub https://github.com/avryl/wp-front-end-editor
I thought about using the save_post
hook:
http://codex.wordpress.org/Plugin_API/Action_Reference/save_post
function redirect_after_edit(){
wp_redirect( home_url() );
exit;
}
add_action( 'save_post', 'redirect_after_edit' );
Although this redirect works when editing a post via the back-end, it doesn't work when using WordPress Front-end Editor to edit a post.
Any idea how I can redirect the user after they've successfully edited a post using WordPress Front-end Editor?
save_post
is called when editing from the front end editor. There's something else going on here. Are the headers already sent at this point? if so, then you can't perform aheader()
call in php. turn on the error reporting. – Ohgodwhydo_($action, $arg1, $arg2)
and performs theget/save
based on the data that that was received form the ajax object. – Ohgodwhyheader redirect
if the headers have already been sent. Go to yourwp-config
file, then findWP_DEBUG
and set it totrue
, then reload the page. If you get, "warning: headers already sent`, then you have identified your problem. – Ohgodwhy