开发者社区> 问答> 正文

wordpress登录后转至wp-admin为空白页

已解决

wordpress网站应该是被黑了,首先恶意注入代码,被我debug清理掉了,但是现在登录后却无法操作wp-admin界面,为空白页。还发现了两篇垃圾博客文章。

我测试过wp-admin白屏的常见解决方案(例如themes或plugins不兼容造成),但这一次都不是。

展开
收起
瓜田夜行人 2016-03-18 15:15:41 7377 0
2 条回答
写回答
取消 提交回答
  • 采纳回答

    debug 模式

    已经使用过了debug模式,其实网站现在仍处于debug模式中,现在没有任何错误提示。最早的时候被恶意注入的代码已经被清理,但是一篇垃圾文章仍在:http://computational-communication.com/topics/blog/

    我在wp_config.php中使用的debug代码如下:

        /**
     * This will log all errors notices and warnings to a file called debug.log in
     * wp-content only when WP_DEBUG is true. if Apache does not have write permission,
     * you may need to create the file first and set the appropriate permissions (i.e. use 666).
     */
    
    define( 'WP_DEBUG', true ); // Or false
    if ( WP_DEBUG ) {
        define( 'WP_DEBUG_LOG', true );
        define( 'WP_DEBUG_DISPLAY', true );
        @ini_set( 'display_errors', 1 );
    }
    
    // Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
    define( 'SCRIPT_DEBUG', true );  
    

    wp-no-white-screen

    使用wp-no-white-screen(https://github.com/stracker-phil/wp-no-white-screen/)进行辅助debug,发现一处可疑的地方:

    Fatal error: Class 'WP_Screen' not found in /wp-admin/includes/class-wp-screen.php
    

    发现这段代码是:

        /**
     * Set the current screen object
     *
     * @since 3.0.0
     *
     * @param mixed $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen,
     *                           or an existing screen object.
     */
    
    function set_current_screen( $hook_name = '' ) {
            WP_Screen::get( $hook_name )->set_current_screen();
    }
    

    WP_Screen并没有定义!这很不应该,搜索应该引用:

    require_once(ABSPATH . '/wp-admin/includes/class-wp-screen.php');
    

    首先在上面代码中引用class-wp-screen.php

    然后,但是我在/wp-admin/includes/路径下找不到class-wp-screen.php。于是在github.com/wordpress/wordpress里找到了这个php,放进这里。

    于是我终于看到了管理界面!

    2019-07-17 18:34:45
    赞同 1 展开评论 打赏
  • 提供下截图 是不是相关代码设置有错误导致的

    2019-07-17 18:34:45
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载