How to edit 404 content via wp editor?

So I’ve got to edit my 404 page. Since my client’s website has 5 languages, I’d like to let him edit and translate the 404 page by himself, with normal WordPress editor. Also, we’re currently using Polylang as the localization plugin.

Is there a way to have the theme’s 404.php as a regular page?

I’ve tried to create a page and then assign it to the 404 template via template name, but it doesn’t work, because it seems that $post is not available inside the template, so I cannot write contents.

2 Answers
2

Found a way.

  • Create a regular page for 404 content, say ‘Page not found’;

  • In your 404.php file, get that page data and then write down your content or whatever…

For example:

$page = get_page_by_title("Page not found");  
if($page) echo apply_filters('the_content',$page->post_content);

Obviously, you can do a lot more…

Leave a Comment