I am trying to create a plugin if the user enables plugin settings then it will replace the homepage of the website with my custom designed template

  • Hi DotSquares! You’ve posted several questions that don’t provide much context about what you’re looking to do or what you’ve tried. Please make sure you’re asking thoughtful, specific questions to increase your odds of getting good answers and helping others that come across your posts later. If someone takes the time to post an answer that solves your problem, please consider accepting that answer as well.
    – Matt Stein
    Commented Jan 5, 2022 at 22:28

1 Answer 1


I would think that you could hook into one of the template render events like:

  • craft\web\View::EVENT_BEFORE_RENDER

Alternatively, you might want to check out the source code for the KnockKnock plugin, which intercepts page loads to present a custom password screen instead of the page being requested.


One of those should point you in the right direction.

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