Change the title of 404 page in wordpress

In WordPress its very simple to create a 404 page, place a file with your design and name it as ‘404.php’. That’s it, very simple your custom 404 page is ready. By default, the title of the 404 page will be showing “Page not found”. If you want to customize that and change that and have your own custom title for the 404 page.

Then open the header.php, file which has the code to generate the html title. you can find the following line in the file.

wp_title( '|', true, 'right' )

Now replace the above line with

if( is_404() ) {
    echo '404 message goes here | ';
} else {
    wp_title( '|', true, 'right' );
}

And you are done, Now you can see your custom 404 error on the browser title bar.

  • Luca Flavius – Manuel

    Not work!!!

    • afaq

      @luca try this.. Add this code in your function.php file

      function change_404_title(){

      if(is_404())
      return “your custom title here”;
      }

      add_filter( ‘wp_title’, ‘change_404_title’, 10, 1 );