Could you point how to create a custom plugin to prevent that our customizations are lost during updates?

Hi Experts

Could you point how to create a custom plugin to prevent that our customizations are lost during updates?

Directly customized theme functions.php

I followed these steps, but something else must to be done to get it working.

1. Create a folder and a file under plugins' folder to customize to avoid directly customize functions.php

2. The plugin is now avaliable
3. But if it's selected, it doesn't exists.
Thanks in advance!
Eduardo FuerteDeveloper and AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
There's already a mechanism for this. provides the mechanism for preserving custom theme code across updates.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chris StanyonWebDevCommented:
Hey Eduardo,

You need to make sure you've removed the relevant code from the functions.php file - you'll get an error if the same code exists in functions.php and your plugin file.
David FavorLinux/LXD/WordPress/Hosting SavantCommented: provides good detail about developing site functionality plugins.

And the link you show above relates to a theme, not a plugin, so likely best to create a Child Theme for you specific situation.
5 Ways Acronis Skyrockets Your Data Protection

Risks to data security are risks to business continuity. Businesses need to know what these risks look like – and where they can turn for help.
Check our newest E-Book and learn how you can differentiate your data protection business with advanced cloud solutions Acronis delivers

Eduardo FuerteDeveloper and AnalystAuthor Commented:

I removed the relevant code and the error persisted.

After following  
create a Child Theme for you specific situation
sugestion everything runs ok...

My doubt is: if it's a much more easyer alternative why is it asked to create a custom plugin?
 * Note: Do not add any custom code here. Please use a custom plugin so that your customizations aren't lost during updates.

Open in new window

Since accordingly to the lessons I had at Youtube, to create a Wordpress plugin is a complex task... Could you explain?
Chris StanyonWebDevCommented:
Creating a plugin is as easy or as complicated as you need it to be. For some simple customisations like yours, it really is very simple. Don't know why it's not working for you - I had exactly the same code and it worked fine, so I would suggest going back over it and double-checking.

Whether you use a plugin or a child-theme will depend on your needs. If you want to customise WooCommerce, use a plugin. If you want to customise your theme, use a child theme.

The reason they suggest creating a plugin is that it's independent of the theme you use. If you create a child theme and add the customisations to your functions.php file, they are only available for that child theme. If you decide to switch themes, you would have to add your customisations to the new theme (and every other theme you wanted to use).

By using a plugin, you are customising WooCommerce itself, and not just the theme, so those customisations will persist throughout your website, no matter which theme you use.
Eduardo FuerteDeveloper and AnalystAuthor Commented:

Sorry my misconceptions.
I'm getting the concepts I need by better reviewing your answers.
Eduardo FuerteDeveloper and AnalystAuthor Commented:
Thanks for help!
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Go through the article I referenced, which has a great table of how to approach different tasks.

In other words, if task is best done at a theme or plugin level.

If you get stumped, just hire someone to work through this with you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.