Is there any possible way that could help me overwrite or redeclare a function inside a plugin? I tried to create a folder with its name inside the child theme, but it did nothing.
The original path to that plugin function is wp/content/plugins/plugin-name/misc/file.php
and the path that I created was /child-theme/plugin-name/misc/file.php
.
The needed function is inside file.php
file. I have to change it because this plugin will be regulary updated. Any tips would be priceless. Thank you
Is there any possible way that could help me overwrite or redeclare a function inside a plugin? I tried to create a folder with its name inside the child theme, but it did nothing.
The original path to that plugin function is wp/content/plugins/plugin-name/misc/file.php
and the path that I created was /child-theme/plugin-name/misc/file.php
.
The needed function is inside file.php
file. I have to change it because this plugin will be regulary updated. Any tips would be priceless. Thank you
1 Answer
Reset to default 0Child themes only let you override templates, but they don't override other PHP files, e.g. anything included from functions.php
.
You can try to change things via hooks, but if the function provides no hooks then you're stuck. There is no way to override it unless a way has been provided by the author of the parent theme.
Your options are:
- fork the parent theme
- contact the author
- Create your own function with a different name, then override every template that uses the original ( this one is a longshot, and won't work if the function is used in a PHP file that isn't a template )