In this article, I'm going to show you what you need to modify the content of your 404 page.
What do you do when you realize that
- the most popular page on your website is the 404 error page?
- the same error page is displaying a bland, default message that doesn't do anything to help to retain your visitors?
The normal answer is: you log in to your website and set out to customize the error page to match your needs. So you hop on to the error page -- by typing ~/error or some random string at the end of your domain name -- hoping there's an "Edit Post" button somewhere. There's only one problem: there's no such button. Crap! Why is it that nothing ever works as it should?
So what do you do now?
- From the sidebar, select the Theme Editor item under the Appearance menu. This will bring up a code editor loaded with a theme file.
- Locate the 404.php file in your theme directory from the list on the right panel.
- Click on 404 Tempalte (404.php); the code will be displayed and you should be able to edit the HTML code and save the modified content as you wish.
The above recipe may or may not work as described. If it doesn't, here are a few common conditions that would cause this not to work:
- The 404 error page may be managed by a plugin already. Scan the plugins list, locate the particular module and modify the settings accordingly.
- Your website may be using a site-building plugin that overrides the default theme options -- such as Beaver, Elementor, DIVI, Brizzy, Oxygen, etc. In that case, you will need to refer to the documentation of the builder to resolve the issue and edit the 404 template or page within the builder.
- Editing and saving the template code may not have any effect on the resulting page. In that case, either you are editing the wrong theme file, or the 404 template is overridden by a plugin or by the theme builder.
- The Save button doesn't work. Your WordPress installation may block your attempt to save your code back to the server -- so the Save button is inactive because the file you are trying to modify is read-only. If that is the case, then your administrative role is restricted and your modifications cannot be written back to the server. You will need to reach out to your developers' team or the hosting company to resolve this issue.
Hoping this helps.