您好,欢迎访问一九零五行业门户网

Wordpress子主题提示:Fatal error: Cannot redeclare YOUR_FUNCTION()

if ( !function_exists( 'your_function' ) ) { function your_function() { // do something. }}

官方文档明明说过用这种方式,子主题可以替换父主题中的一个php函数,只需要简单地对它再次声明。
为什么在实际使用中提示 fatal error: cannot redeclare your_function()
而且这个现象在functions.php更新后不会马上提示,而是过几分钟后才出现
回复内容: if ( !function_exists( 'your_function' ) ) { function your_function() { // do something. }}

官方文档明明说过用这种方式,子主题可以替换父主题中的一个php函数,只需要简单地对它再次声明。
为什么在实际使用中提示 fatal error: cannot redeclare your_function()
而且这个现象在functions.php更新后不会马上提示,而是过几分钟后才出现
同求答案我也遇到这个问题。官方文档不可能出错吧?
其它类似信息

推荐信息