Fatal Error on save_post
-
Hei Abhay
First of all, thanks a lot for the plugin.
I wanted to use the save_post hook, but noticed an fatal error when using said hook. After creating a webhook for save_post, it was not possible to save or create a post / page. It will throw a 500 error after a while. It generates an infinite loop in dispatch_webhook.
This happens because the save_post hook gets called with wp_insert() , and probably happens also for all actions, that are within the log_request() function.
My temporary solution is, to remove the action, and add it later:public function dispatch_webhook()
{
// Prevent re-entry from wp_insert_post in log_request()
remove_action('save_post', [$this, 'dispatch_webhook'], 99);
// ... rest of the functioin code ...
add_action('save_post', [$this, 'dispatch_webhook'], 99, 99);
}Best, Daniel
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.