Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Copa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Cómo desactivar los errores PHP en WordPress

Nota editorial: Ganamos una comisión de los enlaces de socios en WPBeginner. Las comisiones no afectan a las opiniones o evaluaciones de nuestros editores. Más información sobre Proceso editorial.

Recientemente, uno de nuestros lectores nos preguntó cómo desactivar los errores PHP en WordPress.

Las advertencias y avisos de PHP ayudan a los desarrolladores a depurar incidencias en su código. Sin embargo, cuando son visibles para todos los visitantes de tu sitio web, su aspecto es muy poco profesional.

En este artículo, le mostraremos cómo desactivar fácilmente los errores PHP en WordPress.

How to turn off PHP errors in WordPress

¿Por qué y cuándo debe desactivar los errores PHP en WordPress?

Los errores PHP que puede ver en su sitio WordPress suelen ser advertencias y avisos. No se trata de errores internos del servidor, errores de sintaxis o errores fatales, que impiden la carga de tu sitio web.

Los avisos y advertencias son el tipo de errores que no impiden que WordPress cargue su sitio web. Para más información, consulte cómo funciona WordPress entre bastidores.

PHP errors in WordPress admin area

El propósito de estos errores es ayudar a los desarrolladores a depurar problemas con su código. Los desarrolladores de plugins y temas necesitan esta información para comprobar la compatibilidad y las mejores prácticas.

Sin embargo, si usted no está desarrollando un tema personalizado, plugin o sitio web, entonces estos errores deben ser ocultados. Porque si aparecen en el front-end de su sitio web a todos sus visitantes, se ve muy poco profesional.

WordPress warning errors on homepage

Si ve un error como el anterior en su sitio de WordPress, puede informar al desarrollador del tema o plugin correspondiente. Es posible que publiquen una corrección que haga desaparecer el error. Mientras tanto, también puedes desactivar estos errores.

Veamos cómo desactivar fácilmente los errores, avisos y advertencias de PHP en WordPress.

Cómo desactivar los errores PHP en WordPress

Para ello, deberá editar el archivo wp-config.php.

Dentro de su archivo wp-config.php, busque la siguiente línea:

define('WP_DEBUG', true);

También es posible que esta línea ya esté establecida en false. En ese caso, verá el siguiente código:

define('WP_DEBUG', false);

En cualquier caso, debe sustituir esta línea por el siguiente código:

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);

No olvide guardar los cambios y volver a subir el archivo wp-config.php al servidor.

Ahora puede visitar su sitio web para confirmar que los errores, avisos y advertencias de PHP han desaparecido de su sitio web.

Activar los errores PHP en WordPress

Si usted está trabajando en un sitio web en el servidor local o área de ensayo, entonces es posible que desee activar los informes de errores. En ese caso, es necesario editar el archivo wp-config.php y reemplazar el código que ha añadido anteriormente con el siguiente código:

define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);

Este código permitirá a WordPress volver a mostrar los errores, advertencias y avisos de PHP.

Esperamos que este artículo te haya ayudado a aprender cómo desactivar los errores PHP en WordPress. Puede que también quieras ver nuestra lista de los errores más comunes de WordPress y cómo corregirlos, o nuestras selecciones de expertos del mejor software de diseño web.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Descargo: Nuestro contenido está apoyado por los lectores. Esto significa que si hace clic en algunos de nuestros enlaces, podemos ganar una comisión. Vea cómo se financia WPBeginner , por qué es importante, y cómo puede apoyarnos. Aquí está nuestro proceso editorial .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

El último kit de herramientas de WordPress

Obtenga acceso GRATUITO a nuestro kit de herramientas - una colección de productos y recursos relacionados con WordPress que todo profesional debería tener!

Reader Interactions

41 comentariosDeja una respuesta

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. A Owadud Bhuiyan says

    If I keep the debug true, but false the debug display. Will the error show on website?

    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG_DISPLAY’, false);

    • WPBeginner Support says

      The debug display being false would mean that the errors would not be visible on the front-end of your site.

      Administrador

  3. Janet says

    Thank you so much! This fixed my problem in 30 seconds that I have been waiting for my hosting to fix for over 12 hours.

    • WPBeginner Support says

      Glad our guide could help. As a reminder, this hides the error from your site but you would want to try to resolve the root cause of the error you were seeing.

      Administrador

  4. Karan says

    I have already done false in all . But in healthsite status always show WP debugging mode is enabled. please suggest me something

    • WPBeginner Support says

      You likely have it set to true in another section of the code, you likely want to reach out to your hosting provider for them to take a look and assist you.

      Administrador

    • WPBeginner Support says

      You may want to check with your hosting provider to see if they have a log set up from their end

      Administrador

  5. Rebecca P says

    I’ve been advised to turn these notices off and was directed to this article to help me with that. However, I do not have the ‘wp_debug’ line in my config file. Do I just add it in? And if so whereabouts in the file?
    Thanks!

    • WPBeginner Support says

      You may want to ensure you did not miss it in your current file but, you would place the code at the bottom of the file :)

      Administrador

  6. Gary Guss says

    Clueless newbie! I’ve changed the wp-config.php file and saved it .. Do I have to upload this file to the server to get it to work? How do I do that Using Cpanel File manager.. Not seeing any debug suppression so I guess its somehow not picking up the edited file.. Halp Halp!

    Thanks,

    GG

    • WPBeginner Support says

      If you’re using the file manager your host offers, and directly edited and saved through that without downloading the file then the changes should be active on your site and you would want to check with your host for why the changes may not be getting applied to the file.

      Administrador

  7. genfoch01 says

    ok so i know this is old, but i’m stumped. i am still getting php errors.

    Fatal error: Uncaught Error: Call to undefined function get_header() in /path/to/wordpress/wp-content/themes/mytheme/index.php:5 Stack trace: #0 {main} thrown in /path/to/wordpress/wp-content/themes/mytheme/index.php on line 5

    note that this issue was caught by a pen test and i was asked to suppress the error to avoid full paths being reveled. Any ideas would be helpful

    • WPBeginner Support says

      That is a fatal error for why it is still being displayed, you would want to either change themes or let your theme’s support know about the error to let you know how to fix it.

      Administrador

  8. Abdulrahman says

    I faced the same problem after upating woocommerce plugin and the I used your method

    all erroers disappeared, however, I cannot log into the dashboard where it wp-admin shows a blank page

    is there any solution for that

    Thank you

Deja tu comentario

Gracias por elegir dejar un comentario. Tenga en cuenta que todos los comentarios son moderados de acuerdo con nuestros política de comentarios, y su dirección de correo electrónico NO será publicada. Por favor, NO utilice palabras clave en el campo de nombre. Tengamos una conversación personal y significativa.