Is it possible to get WordPress post ID after removing that post? I have found out that I need that ID to remove the page from the site map, but I do not have the post ID, becuase I have deleted it. Sorry if that's the wrong place to ask such a question, but I am looking for the answer and I can't find it anywhere. Thank You for Your help in advance!
1 Answer
There's only one way I can see that you can get the ID after a post is deleted. If you're using wp_delete_post
to delete posts, you add a after_delete_post
action hook where you will then do the other stuff that you need to do like the remove of page from sitemap, etc. The hook has the ID and post object as it's parameter which I think will be enough for what you need for.