Added check for the build published content only setting for delete and insert hook and variable name change for better clarity for its purpose
Closes #3394713