WordPress.org

Ready to get started?Download WordPress

Forums

Redirect to new post after publish (7 posts)

  1. MatthewRuddy
    Member
    Posted 4 years ago #

    Hey just wondering is their any plugin out there or would it be possible after publishing a new post/page to redirect the user to it? Rather than back to the publishing panel.

    Thanks,
    Matthew.

  2. MatthewRuddy
    Member
    Posted 4 years ago #

    *Bump*

    Anyone?

  3. MatthewRuddy
    Member
    Posted 4 years ago #

    Hello? Could someone please help?

  4. MatthewRuddy
    Member
    Posted 4 years ago #

    ??

    Hello?

  5. saeidzebardast
    Member
    Posted 4 years ago #

    same problem, 2.9.2

  6. bjorsq
    Member
    Posted 4 years ago #

    You could try this in your theme functions 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);
                }
            }
        }
    }
  7. MatthewRuddy
    Member
    Posted 4 years ago #

    Hmm.. Works for posts but not pages. :/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.