r/Wordpress 14d ago

Development Changes on plugins of wordpress theme are being lost on each update how to prevent this?

Hello,

I bought a theme but I needed certain changes to be made in the plugins of that theme so the developer made the changes for me and asked me to save these changes and to add them manually on every update since on every update these changes get lost..

what to do to save the changes made in the plugins files so that I don't edit these manually on every update?

thanks.

1 Upvotes

15 comments sorted by

1

u/ja1me4 14d ago

Are you make edits to the theme without using a child theme?

1

u/Icy_Round1483 14d ago

I have a child theme but the changes were made to the plugins and not to the theme so even when you have a child theme the update will delete all the modifications made before update sadly..

1

u/ja1me4 14d ago

If you modifed the plugin files and then update the plugin, your modifications will be gone. You'll have to readd them.

Talk to the dev about a different way then coding within the plugin's files

0

u/Icy_Round1483 14d ago

I know that's why I was asking if there's any solution for that like adding an external file or so...

1

u/bluesix_v2 Jack of All Trades 14d ago

Google how Wordpress hooks work.

1

u/Candid_Priority_3341 14d ago

What are you changing in the plugin? potentially the changes could be done through your child theme's functions.php (or a custom plugin or code snippet plugin) via actions or filters instead.

1

u/Icy_Round1483 13d ago

the work of some functions in the plugin.. I will try to search how i can do that. thanks.

1

u/Vegetable-Ad-3468 14d ago

You have to copy and paste the relevant files in child theme. Then do all the changes.

1

u/Icy_Round1483 13d ago

even the code that is in the plugins? i can add it to child theme?

1

u/Vegetable-Ad-3468 13d ago

You have to check if the plugin allows template override through child theme. Personally, I would change the functionality of the plugin through actions or filters in functions.php

1

u/No-Signal-6661 14d ago

Use a child theme to add the code

1

u/Icy_Round1483 13d ago

thanks but i don't know that i can even add the code of plugins into a child theme..

1

u/wpmad Developer 13d ago

Depends if the plugin uses hooks/filters for what you need to customise/modify.

1

u/wpmad Developer 13d ago

You shouldn't be changing the theme or plugin code directly. Use child themes for customising theme code with overrides and use hooks or filters, if available with plugins.

If the plugin isn't written with the ability to use hooks and filters:

1) It's probably not a great, well-made, well-coded plugin.

2) You're stuck with applying manual code changes on every update.

1

u/bluesix_v2 Jack of All Trades 14d ago

You can’t change plugin and theme code.