7

My plugin init function:

function init(){

    craft()->entries->onSaveEntry = function(Event $event) {

        //redirect to wanted url

    };

}

Is there a fancy way to redirect to my plugin url if, for example the entry channel is jobs.

Or I have to use header() function. Thank you in advance.

2 Answers 2

14

You can use the HttpRequestService:

craft()->request->redirect($myAwesomeUrl);
11

In Craft 3 we are looking at something similar to:

Craft::$app->getResponse()->redirect(UrlHelper::cpUrl('settings/plugins/craft-mailchimp'))->send();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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