Use @wasamasa's solution for adding new headers.
There are no default org commands for removing a heading and updating the todo count at the same time. It is possible to update all todo counts in the document by calling function org-update-statistics-cookies
with the universal argument (C-u C-c #
).
There many ways to remove a heading, so not all of them can not trigger the todo update. You have to create a function for it and include the non-interactive function org-update-parent-todo-statistics
to the end of it. The alternative is to modify an existing command.
The following shows how to modify a command from the worf package:
;; define an advice
(defadvice worf-delete-subtree (after my-org-update-parent-todo ())
(org-update-parent-todo-statistics))
;; activate all advices to this function
(ad-activate 'worf-delete-subtree)
Execute both sexps, place the cursor at the asterisks of the header you want to remove, and press C-d
. The line is deleted and the todo count is updated.