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.

14

You can use the HttpRequestService:

craft()->request->redirect($myAwesomeUrl);
| improve this answer | |
5

In Craft 3 we are looking at something similar to:

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

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.