Hi @kevp75 ,
Unfortunately, not supporting custom code is the policy of most developers who host their plugins on WordPress.org. However, I will explain the issue with your custom code here.
The pseudocode for the snippet you posted in https://wordpress.org/support/topic/error-in-log-table/ is
If there is not a pending "kpcpc_the_log_purge" scheduled action
then
- add an anonymous function to the "kpcpc_the_log_purge"
- schedule the "kpcpc_the_log_purge" action
End if
Your code is only adding a hook to the action when there isn’t a scheduled action for that hook. Once the action is scheduled the hook doesn’t get added. When the action runs by CRON or the async runner it creates the debug log entry. On. the next request to the server, there isn’t a scheduled action so it gets added again and the cycle repeats.
Action Scheduler is designed to run actions in the background instead of running them during a web request. If you are going to be creating your own scheduled actions then the hook for the action needs to added on every request.