When I delete a post, the PostType::saveTitleAs hook gets called. This is because "deleting" the post actually just moves it to the "trash", which requires a post update.
I think at this point, calling that hook, is unnecessary. First of all, the post already has a title at that point and secondly the intent is to remove the post.
You might be able to catch this case inside the hook by checking the post object's post_status (== "trash") property.
When I delete a post, the
PostType::saveTitleAs
hook gets called. This is because "deleting" the post actually just moves it to the "trash", which requires a post update.See the stack trace below:
I think at this point, calling that hook, is unnecessary. First of all, the post already has a title at that point and secondly the intent is to remove the post.
You might be able to catch this case inside the hook by checking the post object's
post_status
(== "trash"
) property.