Override plugin via functions.php question
-
I have an issue where I’m trying override a function in an active plugin. I don’t want to hack the plugin, so I’m trying to override the plugin function in the theme functions.php file.
The plugin function puts out a few lines of javascript and is being run off the ‘wp_enqueue_scripts’ hook.
Now, I’d like to override this javascript in my theme functions.php file. I was under the impression that the ‘init’ hook and ‘plugins_loaded’ hooks should be used to fire off a theme function when you want to be sure the plugins have already loaded.
However, this doesn’t seem to be the case. If I use either ‘init’ or ‘plugins_loaded’ as a trigger to run my function in functions.php, the override doesn’t work.
BUT, the override DOES work, when I use the ‘wp_enqueue_scripts’ hook in functions.php instead of init and plugins_loaded.
I’m confused about the order of precedence here and why ‘init’ and ‘plugins_loaded’ won’t work in my theme to override the plugin function.
Thanks for any help!
- The topic ‘Override plugin via functions.php question’ is closed to new replies.