WordPress: Error messages persist despite hiding attempts

Solution 1:

You could try suppressing errors with:


ini_set('error_reporting', 0);

⚠️ Warning:

  • This is a dirty workaround and only hides the problem.
  • The underlying issue is likely caused by a php.ini setting on the server that cannot be overridden within your code.
  • It’s better to identify and fix the root cause rather than suppressing all errors.

Solution 2:

The issue was caused by server-level PHP settings overriding your local code.

  • The hosting provider had set display_errors = Off in a server-wide php.ini file.
  • As a result, any changes to ini_set(‘display_errors’, 1) in your local code had no effect.

✅ Lesson:

  • Some PHP settings cannot be overridden in scripts if they are enforced at the server configuration level.
  • In such cases, you may need to request changes from the hosting provider or adjust settings in .htaccess or a custom php.ini if allowed.