抱歉,您无权访问此页面。 - wordpress

时间:2016-10-31 22:38:19

标签: php mysql wordpress

我收到此错误消息“抱歉,您无法访问此页面”。 当我去我的页面http://localhost/wordpressstuff/wp-admin/options-general.php?page=editstuff?id=4,当我得到错误,但当我删除?id = 4它删除错误我正在尝试编辑mysql表行但由于某种原因我得到这个在wordpresS 这是我的代码:

/** Step 2 (from text above). */
add_action( 'admin_menu', 'my_edit_news_menu' );

/** Step 1. */
function my_edit_news_menu() {
    add_options_page( 'My Plugin Options', '', 'manage_options', 'editstuff', 'edit_news' );
}

/** Step 3. */
function edit_news() {
    if ( !current_user_can( 'manage_options' ) )  {
        wp_die( __( 'Well You do not have sufficient permissions to access this page. Embarassing is\'nt it' ) );
    }
...

是我点击进入该页面的链接

<h3><?php echo $row['title']; ?></h3> <h4 style="color: lightblue;"><a href="">Delete</a></h4> <h4 style="color: lightblue;"><a href="http://kollossus.com/wp-admin/options-general.php?page=editstuff?id=<?php echo $row['id']; ?>">Edit</a></h4>

哪个是在不同的页面,就像第一个那里的第一位代码只有例外的东西是不同的url等。

谢谢

2 个答案:

答案 0 :(得分:0)

options-general.php?page=editstuff?id=...更改为options-general.php?page=editstuff&id=...

答案 1 :(得分:0)

[已解决]:对不起,您不能访问此页面

每当我转到/ wp-admin /时,都会收到“抱歉,您不能访问 此页面”网站的前端工作正常。

我不是解决WP问题的新手,但这使我感到困惑。

到目前为止,我已经:重置.htaccess禁用了文件夹和数据库中的所有插件 禁用了文件夹和数据库中的自定义主题,并且已完成了 调试

我一直在对数据库进行测试,如果可以,我可以使其正常运行 我用新的构建备份替换了wp_options表。

我现在正在搜索选项表以查找问题。它 可能要花我一段时间,因为我的选项表有4000多行。

任何想法都值得欢迎和赞赏!

解决方案:

好几小时,在phpmyadmin中检查了wp_options表后,我终于发现了问题。 wp_user_role行以某种方式被删除。如果它是由WooCommerce之类的插件编辑/更改的,也会发生这种情况。

因此,要解决此问题,我从全新安装中复制了以下内容,并使用phpmyadmin将其插入到wp_options表中: 请记住用您的数据库前缀替换“ wp _”。

option_name

enter image description here

wp_user_role

option_value

a:5:{s:13:“管理员”; a:2:{s:4:“名称”; s:13:“管理员”; s:12:“功能”; a:61:{ s:13:“ switch_themes”; b:1; s:11:“ edit_themes”; b:1; s:16:“ activate_plugins”; b:1; s:12:“ edit_plugins”; b:1; s: 10:“ edit_users”; b:1; s:10:“ edit_files”; b:1; s:14:“ manage_options”; b:1; s:17:“ moderate_comments”; b:1; s:17: “ manage_categories”; b:1; s:12:“ manage_links”; b:1; s:12:“ upload_files”; b:1; s:6:“ import”; b:1; s:15:“ unfiltered_html “; b:1; s:10:” edit_posts“; b:1; s:17:” edit_others_posts“; b:1; s:20:” edit_published_posts“; b:1; s:13:” publish_posts“; b:1; s:10:“ edit_pages”; b:1; s:4:“ read”; b:1; s:8:“ level_10”; b:1; s:7:“ level_9”; b: 1; s:7:“ level_8”; b:1; s:7:“ level_7”; b:1; s:7:“ level_6”; b:1; s:7:“ level_5”; b:1; s:7:“ level_4”; b:1; s:7:“ level_3”; b:1; s:7:“ level_2”; b:1; s:7:“ level_1”; b:1; s: 7:“ level_0”; b:1; s:17:“ edit_others_pages”; b:1; s:20:“ edit_published_pa​​ges”; b:1; s:13:“ publish_pages”; b:1; s:12: “ delete_pages”; b:1; s:19:“ delete_others_pages”; b:1; s:22:“ delete_published_pa​​ges”; b:1; s:12:“ delete_posts”; b:1; s:19:“ delete_others_posts “; b:1; s:22:” delete_p ublished_posts“; b:1; s:20:” delete_private_posts“; b:1; s:18:” edit_private_posts“; b:1; s:18:” read_private_posts“; b:1; s:20:” delete_private_pages“ ; b:1; s:18:“ edit_private_pages”; b:1; s:18:“ read_private_pages”; b:1; s:12:“ delete_users”; b:1; s:12:“ create_users”; b :1; s:17:“ unfiltered_upload”; b:1; s:14:“ edit_dashboard”; b:1; s:14:“ update_plugins”; b:1; s:14:“ delete_plugins”; b:1 ; s:15:“ install_plugins”; b:1; s:13:“ update_themes”; b:1; s:14:“ install_themes”; b:1; s:11:“ update_core”; b:1; s :10:“列表用户”; b:1; s:12:“删除用户”; b:1; s:13:“促销用户”; b:1; s:18:“ edit_theme_options”; b:1; s:13 :“ delete_themes”; b:1; s:6:“导出”; b:1;}} s:6:“编辑器”; a:2:{s:4:“名称”; s:6:“编辑器“; s:12:” capabilities“; a:34:{s:17:” moderate_comments“; b:1; s:17:” manage_categories“; b:1; s:12:” manage_links“; b:1 ; s:12:“上传文件”; b:1; s:15:“未过滤的html”; b:1; s:10:“ edit_posts”; b:1; s:17:“ edit_others_posts”; b:1; s :20:“ edit_published_posts”; b:1; s:13:“ publish_posts”; b:1; s:10:“ edit_pages”; b:1; s:4:“ read”; b:1; s:7 :“ level_7”; b:1; s:7:“ level_6”; b:1; s:7:“ level_5” ; b:1; s:7:“ level_4”; b:1; s:7:“ level_3”; b:1; s:7:“ level_2”; b:1; s:7:“ level_1”; b :1; s:7:“ level_0”; b:1; s:17:“ edit_others_pages”; b:1; s:20:“ edit_published_pa​​ges”; b:1; s:13:“ publish_pages”; b:1 ; s:12:“ delete_pages”; b:1; s:19:“ delete_others_pages”; b:1; s:22:“ delete_published_pa​​ges”; b:1; s:12:“ delete_posts”; b:1; s :19:“ delete_others_posts”; b:1; s:22:“ delete_published_posts”; b:1; s:20:“ delete_private_posts”; b:1; s:18:“ edit_private_posts”; b:1; s:18 :“ read_private_posts”; b:1; s:20:“ delete_private_pages”; b:1; s:18:“ edit_private_pages”; b:1; s:18:“ read_private_pages”; b:1;}} ss:6 :“作者”; a:2:{s:4:“名称”; s:6:“作者”; s:12:“功能”; a:10:{s:12:“上传文件”; b:1 ; s:10:“ edit_posts”; b:1; s:20:“ edit_published_posts”; b:1; s:13:“ publish_posts”; b:1; s:4:“ read”; b:1; s :7:“ level_2”; b:1; s:7:“ level_1”; b:1; s:7:“ level_0”; b:1; s:12:“删除帖子”; b:1; s:22 :“” delete_published_posts“; b:1;}} s:11:”贡献者“; a:2:{s:4:”名称“; s:11:”贡献者“; s:12:”功能“; a: 5:{s:10:“ edit_posts”; b:1; s:4:“ read”; b:1; s:7:“ level_1”; b:1; s:7:“ level_0”; b:1 ; s:1 2:“ delete_posts”; b:1;}} s:10:“订户”; a:2:{s:4:“名称”; s:10:“订户”; s:12:“功能”; a :2:{s:4:“ read”; b:1; s:7:“ level_0”; b:1;}}}