WPJAM BASIC插件报错提示:if($unread_count = $wpjam_topic_messages[‘unread_count’]){
摘要:大挖的后台今天突然发现了一处报错,if($unread_count = $wpjam_topic_mes…
摘要:大挖的后台今天突然发现了一处报错,if($unread_count = $wpjam_topic_messages[‘u…
大挖的后台今天突然发现了一处报错,if($unread_count = $wpjam_topic_messages[‘unread_count’]){刚开始以为是WPJAM BASIC插件的七牛云存储插件的问题,但是通过再次的设置并没有得到有效的解决,通过百度错误提示,发现了问题所在。
大挖安装的是WPJAM BASIC插件比较旧的版本的,只有2.6.2,通过代码的查看是因为一个WP问题的代码函数出现了问题,因为WPJAM BASIC插件的作品提供了一个简单的问答社区功能,但是其它大挖并不需要,所以直接在后台进行了注释隐藏,问题就有效的解决了。
通过插件的问题目标,找到路径所描述的插件”wpjam-basic/include/topic.php“文件,可以插件找到如下代码(大概在第83行到112行):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
add_filter(‘wpjam_pages’, ‘wpjam_topic_admin_pages’);
add_filter(‘wpjam_network_pages’, ‘wpjam_topic_admin_pages’);
function wpjam_topic_admin_pages($wpjam_pages){
$subs = array();
$menu_title = ‘WP问题’;
if(wpjam_topic_get_weixin_user()){
$wpjam_topic_messages = wpjam_get_topic_messages();
if($unread_count = $wpjam_topic_messages[‘unread_count’]){
$menu_title .= ‘<span class=”update-plugins count-‘.$unread_count.‘”><span class=”plugin-count”>’.$unread_count.‘</span></span>’;
}
$subs[‘wpjam-topics’] = array(‘menu_title’=> ‘所有问答’, ‘function’=>‘wpjam_topics_page’, ‘capability’ => ‘read’);
$subs[‘wpjam-topic’] = array(‘menu_title’=> ‘我要提问’, ‘function’=>‘wpjam_topic_edit_page’,‘capability’ => ‘read’);
$subs[‘wpjam-topic-user’] = array(‘menu_title’=> ‘个人资料’, ‘function’=>‘wpjam_topic_user_page’,‘capability’ => ‘read’);
if(isset($_GET[‘page’]) && ($_GET[‘page’] == ‘wpjam-topic-messages’)){
$subs[‘wpjam-topic-messages’] = array(‘menu_title’=> ‘消息提醒’, ‘function’=>‘wpjam_topic_messages_page’,‘capability’ => ‘read’);
}
}
$wpjam_pages[‘wpjam-topics’] = array(
‘menu_title’ => $menu_title,
‘icon’ => ‘dashicons-wordpress’,
‘subs’ => $subs,
‘capability’ => ‘read’
);
return $wpjam_pages;
}
|
将上面的所有代码注释掉或删除掉即可,上面的代码应该是将“WP问题”这个按钮添加到后台左侧导航的意思,只要将该函数删除即不会在左侧添加按钮了,也不影响插件的其他正常运行。为了插件的安全起见,我没有直接删除代码,而是选择注释。
类别:WordPress教程、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!