admin管理员组

文章数量:1304270

Every time storefront is being updated, my additional functions.php code is being removed.

How to prevent additional code in functions.php to be removed once there is an update?

Is there a plugin or is the only way to do it to create a child theme which in itself is a debug-worthy approach?

Every time storefront is being updated, my additional functions.php code is being removed.

How to prevent additional code in functions.php to be removed once there is an update?

Is there a plugin or is the only way to do it to create a child theme which in itself is a debug-worthy approach?

Share Improve this question asked Feb 14, 2021 at 10:05 Pascal WidmannPascal Widmann 1 1
  • What do you mean debug-worthy approach? – Rup Commented Feb 14, 2021 at 12:24
Add a comment  | 

2 Answers 2

Reset to default 2

There isn’t a way. You need to create a child theme or a plugin and put the functions there.

Note that there’s nothing special about child themes. The point is to put the code into something that somebody else isn’t going to update. So third party child themes aren’t safe either.

You can add a child theme of course, but I recommend you to use the Code Snippets plugin. Here you can add PHP which will run exactly like adding it to the child theme functions.php. However it is much more organised, and is retained once you make an update.

本文标签: pluginsHow to prevent additional code in functionsphp to be removed once there is an update