从主题覆盖插件函数

有一个插件声明了所有演示函数, 以便可以覆盖它们。即:

if (!function_exists('show_thing')){ ... }

应该怎么做?我曾尝试在主题functions.php中声明该函数, 但已在执行时声明了该函数。

如果我使用方法声明创建自己的插件, 那么如何确保在此插件加载和函数被绝对重写之前加载我的插件?


#1


最简单的方法是使用”必须使用插件”。创建一个名为/ wp-content / mu-plugins的文件夹。此目录中的所有PHP文件都将被加载(不必激活), 并在激活的插件或主题文件(包括functions.php)之前执行。在此处使用文件定义要从插件覆盖的函数。

查看此图以获取有关WP Core加载顺序的更多信息:https://wordpress.stackexchange.com/a/26622/20880

来源:

https://www.srcmini02.com/67428.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_40057.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?