Every Plugin Upgrade fill Debug Log with Scraping home page…

[ad_1]

The issue you’re encountering seems to stem from WordPress 6.6’s auto-update and rollback feature that scrapes the homepage to ensure that everything works properly after an automatic update. While this is useful for debugging purposes, it is indeed unnecessary to log the entire HTML of your home page to the debug log after every update.

To resolve this issue, we can adjust the behavior by either preventing the homepage scraping from being logged or suppressing these specific debug entries. Here are two approaches to deal with this issue:

1. Disable Scraping Logging in Debug Log

You can add a filter to prevent logging the scraped HTML output after a plugin update. WordPress offers hooks and filters that you can use to customize its behavior.

Add the following code to your theme’s functions.php file or a custom plugin:

// Disable logging of scraping output after automatic updates.
add_filter('automatic_updates_debug', function($log_entry, $context)
if (strpos($log_entry, 'Scraping home page...') !== false)
// Prevent logging of the HTML body.
return false;

return $log_entry;
, 10, 2);

This code checks if the log entry contains the “Scraping home page…” text and stops that entry from being logged by returning false.

2. Reduce WordPress Debug Log Verbosity

If you don’t need detailed debug information for automatic updates, you can reduce the verbosity of the debug log in general.

In wp-config.php, you can turn off the debug log or only log certain types of errors:

// Disable WP_DEBUG_LOG or set it to a more restrictive mode.
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

// Disable notices and only log errors and warnings
define('WP_DEBUG_LEVEL', E_ERROR | E_WARNING);

This reduces the amount of information logged, including potentially the full HTML scrape output. However, this method may suppress other useful debug information, so it is recommended only if you don’t require extensive logging.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer