Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

How can you modify a Wordpress Plugin the right way, so that you don't have to touch the files of the plugin?

How can you modify code of the Wordpress Plugin and not change the files of the plugin. Modify the plugin and put the new code in the functions.php.

Jake Lundberg
Jake Lundberg
13,965 Points

What about the plugin are you trying to change? If it is just the CSS, then you can do that in your own styles sheet and override the plugin's CSS. But if you are trying to modify the plugin's functionality (ie. JS, PHP, etc.), you will have to modify the plugin files...

4 Answers

Sue Dough
Sue Dough
35,800 Points

Yes hooks and filters. There is tons of plugins that extend other plugins. Hopefully the plugin was written well otherwise you won't have a choice.

I want to modify the plugin's functionality. And i don't want to modify it directly in the plugin's files. So i can keep the files untouched. For example if you want to customize a WordPress theme, you make a child theme, right? Is there a way to make maybe a child plugin?

Jake Lundberg
Jake Lundberg
13,965 Points

It kind of depends on what exactly you are trying to do...but in general, no, I am not familiar with a way to indirectly modify the functionality of a plugin...perhaps someone here with more experience than myself knows of a way, but I am unfamiliar with how to do that without modifying the plugin's code directly.

Andi Wilkinson
Andi Wilkinson
26,822 Points

you would see what core functions it's hooking into and write your own custom hooks / filters