In WordPress when you update or add a new post, you will be redirected to posts page where list of posts are displayed, if you want to redirect to new post then i found out a simple way by adding a simple snippet in your functions.php file.
add_filter('redirect_post_location', 'redirect_to_post_on_publish_or_save'); function redirect_to_post_on_publish_or_save($location){ if (isset($_POST['save']) || isset($_POST['publish'])) { if (preg_match("/post=([0-9]*)/", $location, $match)) { $pl = get_permalink($match[1]); if ($pl) { wp_redirect($pl); } } } }
No comments:
Post a Comment