Title: Avoid deleting code after update (function.php)
Last modified: July 26, 2021

---

# Avoid deleting code after update (function.php)

 *  [maitredamdam](https://wordpress.org/support/users/maitredamdam/)
 * (@maitredamdam)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/avoid-deleting-code-after-update-function-php/)
 * Hello, I wanted to know if it was possible to keep a part of a code on the function.
   php file of WP despite an update.
    I explain myself for security reasons I would
   like to integrate scripts to hide error messages on the function.php file. Except
   that at each update function.php is reset. So I would like the codes I integrated
   to stay or to be automatically integrated on the file after an update without
   me having to write it each time. If this is possible, please tell me how to do
   it. Thanks in advance for your answers. Have a nice day !
    -  This topic was modified 4 years, 10 months ago by [maitredamdam](https://wordpress.org/support/users/maitredamdam/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [aidenturner](https://wordpress.org/support/users/aidenturner/)
 * (@aidenturner)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/avoid-deleting-code-after-update-function-php/#post-14700056)
 * Hi [@maitredamdam](https://wordpress.org/support/users/maitredamdam/) ,
 * You might consider using a child theme or add the code snippet via a plugin such
   as [Code Snippets](https://wordpress.org/plugins/code-snippets/).
 * Hope it helps.
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/avoid-deleting-code-after-update-function-php/#post-14700113)
 * Use a [child theme](https://developer.wordpress.org/themes/advanced-topics/child-themes/),
   or create your own [custom plugin](https://codex.wordpress.org/Plugin_API).
 *  Thread Starter [maitredamdam](https://wordpress.org/support/users/maitredamdam/)
 * (@maitredamdam)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/avoid-deleting-code-after-update-function-php/#post-14702527)
 * Thanks guys. Now I use child theme. ANd it’s work !

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Avoid deleting code after update (function.php)’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [maitredamdam](https://wordpress.org/support/users/maitredamdam/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/avoid-deleting-code-after-update-function-php/#post-14702527)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
