I'm editing an entry in the CP...


Now when I save this entry, it will redirect me back to the entry index page. However, I'd like to override this behavior, and get redirected to a different page upon saving.

Is it possible to override the redirect target when saving an entry?



Assuming you're using some sort of business logic plugin (if you don't have one, get one), then simply put this code in your main *Plugin.php file...

public function init()

    // Trigger template hook
    craft()->templates->hook('cp.entries.edit', function(&$context)

        // Check to ensure that you're in the right section
        if ('mySection' == $context['sectionHandle'])

            // Specify the preferred URI
            $uri = 'special-page/'.$context['entry']->uri;

            // Set the "Save" button redirect
                $(function () {

            // Set the `cmd + s` shortcut redirect
            $context['saveShortcutRedirect'] = $uri;



  • This almost works in Craft 3, changing to Craft::$app->getView()->hook('cp.entries.edit', function(array &$context) {} and Craft::$app->getView()->registerJs(). The saveShortcutRedirect part works fine for cmd+s saves, but even if you use the hashed version of the $uri (via Craft::$app->getSecurity()->hashData($uri)) it 1) triggers the "something has changed" behavior so even if you don't actually edit anything in the form, it warns you before leaving the page and 2) redirects to /admin{$uri}. Anybody have hints on how to implement a redirect-after-save in Craft 3?
    – natebeaty
    Sep 12 '18 at 15:54
  • @natebeaty I'd recommend posting a new question. Feel free to link back to this thread for reference!
    – Lindsey D
    Sep 12 '18 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.