Answers.Body: <p>That looks like your extension is deleting the entity tag?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-02T17:25:50.283Z
Answers.Text: No - it’s not the extension -the extension just prints all hooks that are invoked but the actual post delete tag happens elsewhere. It’s something like: post create address hook is invoked before post create individual hook - contact_id does exist when this post create address hook is invoked (in a memory layer perhaps?) - so it does let me create the tag (API call is happy) but then shortly after some bits are purged/cleaned up and my tag is deleted;
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-02T17:19:05.127Z
Answers.LastActivityDate: 2019-07-02T17:19:05.127Z
Answers.UserDisplayName: Alan Dixon
Body: <p>I've run into this twice this month and scratching my head. Read this image upside down: We hit post create Address hook -> my regex extension creates a Tag - all good; happy dance; then something in Core deletes my Tag :-( why? </p>
  
  <p><a href="https://i.sstatic.net/OTQBj.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OTQBj.jpg" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-03T00:14:07.370Z
Comments.Text: At some point it must be calling a SQL query with the words `delete` and `tag` in the query. Assuming it's coming from the civi side somewhere can you put a hack in CRM_Core_DAO::executeQuery to do a case insensitive check for those words in the query and then log a debug_backtrace()? That might not catch it but it might.
Comments.UserDisplayName: Demerit
Tags: <hooks><tags>
Title: What is deleting my Tag?
ThreadText: # What is deleting my Tag?
  
  (Asked by: username_0 on 2019-06-26)
  
  I've run into this twice this month and scratching my head. Read this image upside down: We hit post create Address hook -> my regex extension creates a Tag - all good; happy dance; then something in Core deletes my Tag :-( why?
  
  [![enter image description here](https://i.sstatic.net/OTQBj.jpg)](https://i.sstatic.net/OTQBj.jpg)
  
  **Tags:** hooks, tags
  
  > **Comments:**
  > **username_1**: At some point it must be calling a SQL query with the words `delete` and `tag` in the query. Assuming it's coming from the civi side somewhere can you put a hack in CRM_Core_DAO::executeQuery to do a case insensitive check for those words in the query and then log a debug_backtrace()? That might not catch it but it might.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-07-02. Score: 0
  
  That looks like your extension is deleting the entity tag?
  
  > **Comments:**
  > **username_0**: No - it’s not the extension -the extension just prints all hooks that are invoked but the actual post delete tag happens elsewhere. It’s something like: post create address hook is invoked before post create individual hook - contact_id does exist when this post create address hook is invoked (in a memory layer perhaps?) - so it does let me create the tag (API call is happy) but then shortly after some bits are purged/cleaned up and my tag is deleted;  
  
  ---
  
  