I am using create post plugin. But the issue with this is, I want to redirect it to a custom URL if an error occurred in createPost() default to execute the function.

For example, if a customer with the same email id already exists then it goes in the catch of default createPost() execute function's catch. I want to redirect it to my custom page.

Please note, No code to add in try. So try-catch is not used.

Also tried with throw exception but I don't know how to direct with throw exception or with throw it is possible or not.

Thanks in advance.

  • if you can add code then its better to understand Sep 5, 2021 at 9:37

1 Answer 1


You can add redirect code in Catch section instead of show/print error.


   //your logic / code 

  if error then it comes in catch so,add your redirect code here


Your Answer

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

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