WordPress 6.1.1 shows deprecated errors with PHP 8.1 & 8.2

This is not actually an error, rather a deprecation notice. Which means, future versions of PHP will remove some old language features, so the developers should be aware of it.

Info. for WordPress:

WordPress developers are well aware of it and future versions of WordPress will be changed and this deprecation notice will no longer appear.

For now, Yes, you may use the following in development environment to suppress the notice (while still being able to debug using the log files):

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

However, in production, it’s safe to turn off WP_DEBUG all together:

define( 'WP_DEBUG', false );

This will suppress all errors in production, so there’s no reason to worry about it.

To confirm it further, the following is from WordPress core support ticket:

Excerpt from WordPress support

Info. for PHP:

If you have control of your PHP installation, you may suppress deprecation notices from PHP end as well. This is not recommended in development, but in production you should suppress deprecation notices from PHP end as well.

For example, in php.ini, you may set the following to suppress deprecation notices:

error_reporting = E_ALL ^ E_DEPRECATED

tech