how to change the 404 error title in wordpress

0

Hello everyone I've been looking for days how to change the title of wordpress error 404, I currently see "page not found" and I want to change that title for another, but I could not find where in the script I change it, I hope that can you help me?

    
asked by Marlon Camacho Polo 15.05.2017 в 15:15
source

1 answer

4

There are several possibilities

If your theme has a page called 404.php there you should change the title.

If you do not have that page, you can do it with a filter on your functions.php page. Just add this fragment

add_filter('pre_get_document_title', 'toledano_cambio_404', 10);
function toledano_cambio_404($title) {
  if (is_404()) {
    return 'No encontramos lo que buscabas';
  }
  return $title;
}
  

Important

     

Do not indicate which version you use, but this example only works with the Wordpress version 4.7.4 or higher .

    
answered by 15.05.2017 / 17:59
source