2920 | | /* |
2921 | | * If the `update_plugins` site transient is empty (e.g. when you update |
2922 | | * two plugins in quick succession before the transient repopulates), |
2923 | | * this may be the return. |
2924 | | * |
2925 | | * Preferably something can be done to ensure `update_plugins` isn't empty. |
2926 | | * For now, surface some sort of error here. |
2927 | | */ |
2928 | | if ( $plugin_update_data === true ) { |
| 2919 | if( is_wp_error( $result[ $plugin ] ) ) { |
| 2920 | |
| 2921 | $status['error'] = $result[ $plugin ]->get_error_message(); |
2934 | | if ( $plugin_data['Version'] ) { |
2935 | | $status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
| 2926 | $plugin_update_data = current( $result ); |
| 2927 | |
| 2928 | /* |
| 2929 | * If the `update_plugins` site transient is empty (e.g. when you update |
| 2930 | * two plugins in quick succession before the transient repopulates), |
| 2931 | * this may be the return. |
| 2932 | * |
| 2933 | * Preferably something can be done to ensure `update_plugins` isn't empty. |
| 2934 | * For now, surface some sort of error here. |
| 2935 | */ |
| 2936 | if ( $plugin_update_data === true ) { |
| 2937 | wp_send_json_error( $status ); |
| 2938 | } |
| 2939 | |
| 2940 | $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
| 2941 | |
| 2942 | if ( $plugin_data['Version'] ) { |
| 2943 | $status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
| 2944 | } |
| 2945 | $status['test'] = $result[ $plugin ]; |
| 2946 | wp_send_json_success( $status ); |
| 2947 | |