Fixes PHP notices related to comments#386
Conversation
|
@donnchawp I'm not sure that's the best way, but it seems as readable code without a lot of changes:
Related to French - WP uses (from 3.0 to 4.8) this condition:
|
|
For first iteration, I decided to add at the begin of function if ( defined( 'DONOTDELETECACHE' ) ) {
return;
} |
| global $super_cache_enabled, $wp_cache_request_uri; | ||
|
|
||
| if ( defined( 'DONOTDELETECACHE' ) ) { | ||
| return; |
|
Looks great and definitely improves that function, but it should return the post ID those two times it returns early. |
|
Function I've checked it with xdebug and it seems that this function only define constant https://developer.wordpress.org/reference/hooks/trackback_post/ I just checked again and all hooks are actions. So, it makes sense to we totally remove return post_id (and probably reorganize the code) in the future. We should think over about it. Anyway, I'll try to add post_id now to we keep compatibility with legacy code. |
| ) { | ||
| wp_cache_debug( "Delete all SPAM or Trash comments. Don't delete any cache files.", 4 ); | ||
| define( 'DONOTDELETECACHE', 1 ); | ||
| return; |
|
You're right! Thanks for checking. I think that function should be renamed in the future so it's obvious it's not returning something. I had forgotten that. I'll merge this code as-is. We can see about further improvements later. Thanks! |
Fixes #385