Archived topic
404 Page
8 replies · Started by Charles on December 16, 2019
How best to edit what is displayed on the 404 page? Thanks.
Hi there,
What are you hoping to change?
Here are a couple of filters for the default text:
https://docs.generatepress.com/article/generate_404_text/
https://docs.generatepress.com/article/generate_404_title/
Let me know :)
Maybe I want to use redirects instead?
I'm having trouble finding the source of my 404 errors. which of my pages is the bad link on?
Maybe something like this would help?
https://generatepress.com/forums/topic/all-404-page-redirect-to-homepage/#post-667262
This isn't related to the theme itself.
@Leo
Where do I put these filters? I don't see where in GeneratePress I can add them?
add_filter( 'generate_404_title','generate_custom_404_title' );
function generate_custom_404_title()
{
return 'Custom 404 title';
}
add_filter( 'generate_404_text','generate_custom_404_text' );
function generate_custom_404_text()
{
return 'Custom 404 text';
}
Where do I use the above code?
Thank you,
Roger
Hey Roger,
Try one of these methods:
https://docs.generatepress.com/article/adding-php/
Code Snippets plugin would be my recommendation if you aren't using a child theme already.
Thank you! :)
No problem :)