Automattic/regenerate-thumbnails

Cannot regenerate thumbnails if WP_DEBUG is set to true & notices are present

Closed this issue · 1 comments

I've set up two environments (Site A & Site B), both with WP_DEBUG set to true in wp-config.php.

In Site A there are no notices present, and the Regeneration works flawlessly.

In Site B however, I have a couple of notices displaying, and the Regeneration does not work.

screenshot-1

screenshot-2

In the first screenshot, you'll also notice only one of the buttons are displaying.

Let me know if you need any other info from me about it. Happy to help if I can, just not sure what this could be 👍

I develop the plugin with WP_DEBUG enabled to make sure that my plugin doesn't have any normally hidden errors, so this isn't the fault of my plugin (plus it works fine on site A!).

You issue is almost certainly that you have a different plugin that is outputting errors, such as PHP notices or warnings. This is malforming the REST API response by outputting something starting with <.

WP_DEBUG shouldn't really be used on production sites, but try setting define( 'WP_DEBUG_DISPLAY', false ); so that errors aren't outputted to the browser. You can set define( 'WP_DEBUG_LOG', true ); if you want to log them to a file instead.

See https://codex.wordpress.org/Debugging_in_WordPress

This is also a great plugin: https://wordpress.org/plugins/query-monitor/ (it does a ton more than just queries)