I've written a plugin that imports a CSV and creates entries from that for a client. I'm wanting to redirect them to the entries listing page after (i.e. /admin/entries/tvListings) and show a flash message saying "X TV listings imported.".

So this is a 2 parter:

  1. How do you set flash data in Craft 3.
  2. Is there a default flash key that'll show as soon as I land on the entries listing page?


1 Answer 1


To show a message


To show an error


There is no "default" key that is always shown or something like that. You just use the function and set a message -> the next time the user visits any page the message is shown.

  • Hi Robin - that doesn't seem to work for me. I set the flash message then redirect away with '\Craft::$app->controller->redirect("/admin/entries/tvListings");' and I get no flash message.
    – JamesNZ
    Commented Apr 4, 2018 at 20:54
  • I'm really sorry... I messed up the functions. Please see my update Commented Apr 4, 2018 at 20:59
  • You're a gentleman and a scholar. That worked perfectly. Thanks Robin.
    – JamesNZ
    Commented Apr 4, 2018 at 23:20

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.