Updating failed message when a wp_insert_post function is hooked to save_post ho
-
I was creating a function which creates a new custom post type with the category or taxonomy name if it was created from the post editor. I am simply using the wp_insert_post function with the taxonomy name as the post title and content and I am hooking the function to the save_post hook.
The function is working fine on the classic editor. However, it is not working on the new WordPress block editor. Once I save the post, it gives me “Updating failed” message. On the console, it gives me internal server error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
with the REST API url as follows:
https://localhost:8000/mywebsite/wp-json/wp/v2/posts/3447?_locale=userI have checked the function and I made sure that the problem comes from the wp_insert_post function as updating the post works once I comment it out.
If someone knows why this happens and how it could be overcome, I would be grateful.
Thanks
- The topic ‘Updating failed message when a wp_insert_post function is hooked to save_post ho’ is closed to new replies.