我使用 wp-jalali
wordpress插件它有一个函数 farsi_num
. 我使用此功能,但如果未安装插件,则此功能未定义 .
我把以下代码放在我的 functions.php
中
if(!function_exists('farsi_num'))
function farsi_num( $val ) {
return $val;
}
但是当用户想安装 wp-jalali
插件时我们有错误!
致命错误:无法在F:\ xampp \ htdocs \ wordpress \ wp-content \中重新声明farsi_num()(之前在F:\ xampp \ htdocs \ wordpress \ wp-content \ themes \ khoshkhabar \ functions.php:54中声明)第119行的plugins \ wp-jalali \ lib \ deprecated_fns.php
在 wp-admin/plugins.php
2 回答
尝试使用
add_filter
:LINK在
function.php
in your plugin
我理解你的问题 . 文件
deprecated_fns.php
中的错误未在functions.php
中触发 . 因为之前包括functions.php
. 所以你必须检查文件deprecated_fns.php
中的function_exits或者在functions.php
中为你的函数使用其他名称