How to replace a function within a plugin?
-
Hello,
I would like to know if it’s possible to override a function declared within a plugin, by inserting code into my child theme’s functions.php file.
Based on my Google research, I’ve found I can either:
1. Edit the plugin files and risk changes being overwritten later
2. Copy the entire plugin into my functions php, and miss out on future updates from the plugin authorIs there another way to do this?
I’ve tried placing my edited function into my child theme’s functions.php file, surrounding it by this (example only):
if( !function_exists('the_plugin_function_name;)) { function my_better_function( 'code goes here' ); }
I’d appreciate some advice here. I’m only a beginner with php.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to replace a function within a plugin?’ is closed to new replies.