wordpress-581849_1280

Suppressing WordPress Errors


WordPress calls home regularly. It can be suppressed by adding

define('WP_HTTP_BLOCK_EXTERNAL', true);

to your wp-config.php file.

But then, if you are a developer, you may have included the debug detective, as you are advised to:

define('WP_DEBUG', true);

This will cause ugly notices about not being able to connect to WordPress:

PHP Warning: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)

At this point, you may throw up your hands and decide to take out one of these two defines. But there is no need. To fix this warning message, it is only necessary to edit two core files to add the notice-suppression character @. Just two, in fact.
wp-admin/includes/class-wp-plugin-isntall-list-table.php, around line 194,

$api = @plugins_api( 'query_plugins', $args );

and
wp-admin/includes/plugin.php, around line 503

@call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));

Note that your modifications will disappear when you update the WordPress core. Also, be aware that when you disable the call-home feature, you are effectively asking your blog not to automatically check for updates. Keeping your blog and your plugins updated is recommended in order to benefit from all the security fixes.

Then again, some of the plugins go pro by removing some of their features from their publicly available versions on the WordPress repository. In those cases, you may want to prevent automatic updates only for those plugins, after installing the last known good version of it. One way to do it would be to change the plugin version to a large one (I use 99.99.99) by editing the main plugin file and the readme.txt file.