【发布时间】:2022-01-20 19:28:47
【问题描述】:
我尝试手动备份我的 Wordpress 网站。
- 我备份了我的 htdocs 文件夹。
- 我导出了我的数据库的 .sql 文件备份,它以“mas”为前缀。 (后面没有下划线)
- 我在所有数据库中为新 URL 更新了旧 URL(使用 PowerShell)。
- 我更新了 wp-config.php 文件。
- 我在本地服务器上创建了一个同名的新数据库。
- 我在 PhpMyAdmin 上导入了 .sql 文件。
在那之后,我意识到我无法以管理员身份访问仪表板。
我收到以下信息:Désolé, vous n'avez pas l'autorisation d'accéder à cette page。
法语相当于:对不起,您无权访问此页面。
所以我停用了所有插件。 我将 .htaccess 文件更改为 .htaccess.old 。
在我的数据库中,我的表 usermeta 是为我的用户帐户配置的。由于某种原因,我有两次“prefix_capabilites”和“prefix_user_level”:
| meta_key | meta_value |
|---|---|
| mascapabilites | a:1:{s:13:"administrator";b:1;} |
| masuser_level | 10 |
| wp_capabilities | a:1:{s:13:"administrator";b:1;} |
| wp_user_level | 10 |
然后,我尝试使用 PHPStorm 调试我的网站。
这是我发现的:
// plugin.php
function user_can_access_admin_page() {
global $pagenow, $menu, $submenu, $_wp_menu_nopriv, $_wp_submenu_nopriv,
$plugin_page, $_registered_pages;
$parent = get_admin_page_parent();
// I omitted some functions here...
if ( empty( $parent ) ) { // $parent is empty ""
if ( isset( $_wp_menu_nopriv[ $pagenow ] ) ) { // $pagenow is "index.php"
return false; // It returns here.
}
然后,它返回这里:
// menu.php
if ( ! user_can_access_admin_page() ) {
/**
* Fires when access to an admin page is denied.
*
* @since 2.5.0
*/
do_action( 'admin_page_access_denied' );
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); // And displays this.
}
所以,据我了解,我的页面 index.php 对于表 $_wp_menu_nopriv[] 被认为是 TRUE。
这在一定程度上证实了用户无法访问管理页面。
但我不明白这个变量 $_wp_menu_nopriv[] 是什么意思?
你能帮帮我吗?
更新:
我尝试将我的用户 wp_capabilites 值更改为: 'a:1:{s:13:"管理员";s:1:"1";}'
但它也不起作用。
当我尝试使用备份插件备份我的网站时,总会出现错误。
【问题讨论】: