in our site we are hooking into the register_post_type function to execute code for each of our custom post types, and then we want to undo that code when removing a custom post type via the Toolset UI but Toolset doesn't seem to execute the unregister_post_type action when removing a custom post type. Can you please share any insights on how we can execute code when a custom post type is removed via the Toolset UI? Thanks in advance!
Jamal doesn't work Weds/Thurs, so let me jump in and answer you directly.
There isn't an action equivalent to delete_post_type fired by Types when a post type is deleted.
But looking at the source code, I did spot a filter that is applied during the process of deleting a post type which I think should serve your needs.
This is a filter rather than an action, and so needs to return the first parameter.
In this case I simply dumped the second parameter to the log to check what it contains, and it is a string with the slug of the post type being deleted.
Hello again, I wonder if you had the time to check Nigel's reply! Please let us know if it suits your use case.
Otherwise, please provide more details on your use case. You explained that your hook makes sure there is an entry for each custom post type in a repeating field group. Can you provide more details, or share the custom code you use. I am setting your next reply as private in case you don't want the code to be public. Just enter fake credentials to validate the form.