Controller for 404.php

I’ve yet to work out how to create a a controller for the 404.php file. I have created traits which I use across several page controllers and would like to do the same for the 404 page.

Creating class 404 {} obviously won’t work as PHP doesn’t allow class names to start with a number. So how do I create a 404 controller?

The documentation for soberwp/controller explains this: https://github.com/soberwp/controller#template-override-option

Thanks that’s done the job nicely!

This topic was automatically closed after 42 days. New replies are no longer allowed.