最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Can't modify plugin function

programmeradmin1浏览0评论

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

Share Improve this question edited Mar 26, 2020 at 15:39 Tom J Nowell 61.1k7 gold badges79 silver badges148 bronze badges asked Mar 26, 2020 at 15:17 mocimasmocimas 1
Add a comment  | 

1 Answer 1

Reset to default 0

Child 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 )

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论