WordPress管理员和前端未打开


WordPress admin and front end not opening

我的网站http://www.empoweryourfamily.org/wordpress/

我正在开发一个插件,并在functions.php 中编写了以下代码

add_action( 'wp_enqueue_scripts', 'table' );
function table() {
    wp_register_script('table1', plugins_url() . '/Webinar_Reg/table.js', false, null, true);
    if(is_admin()){
         wp_enqueue_script('table1'); 
    } 
}

但是,当我点击更新的那一刻,一切都变成了空白,现在前端和后端都没有打开。

您很可能在functions.php中出现语法错误,或者已经定义了函数table()

尝试回滚刚刚应用的更改。否则,请尝试在服务器日志中查找特定错误。

table用作函数名是一种不好的做法。您应该以一种完全唯一的方式命名一个函数。使用类似mypluginname_tablemytheme_table的东西,其中mypluginname是插件的名称,mytheme是主题的名称。记住,函数名称必须是唯一的,没有两个函数可以有相同的名称,除非其中一个被封装在if(!function_exists()) {}条件语句

我刚刚用旧的(备份文件)文件替换了修改后的functions.php文件,它现在可以正常打开了。谢谢你的回答。