wordpress安装插件提示:wordpress发生意外错误的解决方法

云墨
云墨
云墨
647
文章
0
评论
2018年8月30日 评论 1,283

wordpress安装插件提示:wordpress发生意外错误的解决方法

安装wordpress插件,提示报错“wordpress发生意外错误,可能WordPress.org或服务器配置文件存在问题”

出问题的页面是http://*.*.*.*/wp-admin/update.php?action=install-plugin&plugin=bbpress&_wpnonce=39e9668a43

查看/wp-admin/update.php这个文件,处理action=install-plugin这个get请求的代码如下:

  1. } elseif ( 'install-plugin' == $action ) {
  2.         if ( ! current_user_can('install_plugins') )
  3.             wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
  4.         include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
  5.         check_admin_referer( 'install-plugin_' . $plugin );
  6.         $api = plugins_api( 'plugin_information', array(
  7.             'slug' => $plugin,
  8.             'fields' => array(
  9.                 'short_description' => false,
  10.                 'sections' => false,
  11.                 'requires' => false,
  12.                 'rating' => false,
  13.                 'ratings' => false,
  14.                 'downloaded' => false,
  15.                 'last_updated' => false,
  16.                 'added' => false,
  17.                 'tags' => false,
  18.                 'compatibility' => false,
  19.                 'homepage' => false,
  20.                 'donate_link' => false,
  21.             ),
  22.         ) );

继续查看wp-admin/includes/plugin-install.php的plugins_api方法:

  1. if ( false === $res ) {
  2.         $url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
  3.         if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
  4.             $url = set_url_scheme( $url, 'https' );
  5.         $http_args = array(
  6.             'timeout' => 15,
  7.             'body' => array(
  8.                 'action' => $action,
  9.                 'request' => serialize( $args )
  10.             )
  11.         );
  12.         $request = wp_remote_post( $url, $http_args );
  13.         if ( $ssl && is_wp_error( $request ) ) {
  14.             trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
  15.             $request = wp_remote_post( $http_url, $http_args );
  16.         }
  17.         if ( is_wp_error($request) ) {
  18.             print_r($request->error_data);
  19.             echo $request->errors;
  20.             $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
  21.         } else {
  22.             $res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
  23.             if ( ! is_object( $res ) && ! is_array( $res ) )
  24.                 $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
  25.         }

经过了一下午的挣扎,然后想,访问wordpress的时候一直比较慢,是不是连接超时了呢?

在ping.chinaz.com上ping api.wordpress.com,找了一个比较快的ip地址66.155.40.186,配置到/etc/host中,果然好了。

1. 如有链接无法下载、失效或广告,请联系QQ:181289218 处理!
2. 本站的所有资源为购买、网络收集,或者用户投稿的资源,版权归原作者及网站所有!
3. 如若侵犯了您的权利,请及时联系站长删除!
4. 本站提供的资源,都不包含技术服务请大家谅解!
5. 此软件“仅限学习交流,不能用于商业用途”!
6. 如用于商业用途,请到官方购买正版软件,追究法律责任与“云墨SEO”站点无关!
  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 站长技术资源群
  • QQ群:431710796
  • weinxin
云墨
  • 本文由 发表于 2018年8月30日
  • 转载请务必保留本文链接:https://www.yunmoseo.com/1486.html
做一个网站要花多少钱?WordPress网站成本分析 网站建设

做一个网站要花多少钱?WordPress网站成本分析

做一个网站要花多少钱?这是一个复杂的问题,最直接的回复就是从几十块钱到几万块钱不等,当然还有更高的具体价格取决于你的需求,这个视频我会和大家分享三种建站方式,这三种方式成本相差巨大,最后再分享用wor...
如何为WordPress网站配置SMTP发信邮局 网站建设

如何为WordPress网站配置SMTP发信邮局

默认情况下,WordPress使用不可靠的PHP邮件功能,并且所发出的电子邮件经常会被邮件服务商标记为垃圾邮件。使用SMTP服务器是确保WordPress电子邮件可传递性的最佳方法。 在本教程中,我们...
WordPress程序设置404.php模板 网站建设

WordPress程序设置404.php模板

当你访问的WordPress站点的网址不存在时,WordPress会调用主题的404.php模板来返回404错误信息,比如: 最近,我需要一种编程方式来触发我的一个免费WordPress插件中的404...
匿名

发表评论

匿名网友