Hide title if 404 error
I don't think you need a custom module for something like this...
This should be as easy as:


Go to Configuration -&gt; System -&gt; Basic Site Settings, get the page URL you have for the 404 page.
Go to Structure -&gt; Block Layout, edit the 'Page Title' block, and exclude it under the Visibility section, by page URL from step1.