diff --git a/includes/helpers-api.php b/includes/helpers-api.php index bcdbf20..d6433c2 100644 --- a/includes/helpers-api.php +++ b/includes/helpers-api.php @@ -33,7 +33,7 @@ function wpvulnerability_get( $type, $slug = '' ) { $url .= $slug . '/'; } $response = wp_remote_get( $url, $args ); - if ( 200 === $response->get_error_code() ) { + if ( !is_wp_error( $response ) ) { $body = wp_remote_retrieve_body( $response ); set_transient( $key, $body, HOUR_IN_SECONDS * 4 ); } @@ -187,7 +187,7 @@ function wpvulnerability_get_statistics() { if ( ! $vulnerability ) { $url = 'https://www.wpvulnerability.net/'; $response = wp_remote_get( $url ); - if ( 200 === $response->get_error_code() ) { + if ( !is_wp_error( $response ) ) { $body = wp_remote_retrieve_body( $response ); set_transient( $key, $body, HOUR_IN_SECONDS * 4 ); } diff --git a/readme.txt b/readme.txt index ffa844e..bf79748 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: javiercasares, davidperez, lbonomo Tags: security, vulnerability, site-health Requires at least: 5.2 Tested up to: 6.1 -Stable tag: 1.2.2 -Version: 1.2.2 +Stable tag: 1.2.3 +Version: 1.2.3 License: EUPL v1.2 License URI: https://www.eupl.eu/1.2/en/ @@ -69,6 +69,9 @@ First of all, peace of mind. Investigate what the vulnerability is and, above al == Changelog == += 1.2.3 = +* Fix WP_Error object. + = 1.2.2 = * Fix WP_Error object. diff --git a/wpvulnerability.php b/wpvulnerability.php index 630ad31..f679d9d 100644 --- a/wpvulnerability.php +++ b/wpvulnerability.php @@ -5,7 +5,7 @@ * Description: Check the security of a WordPress site with information from the WordPress Vulnerability Database API. Scans Core, plugins, and theme vulnerabilities. * Requires at least: 5.2 * Requires PHP: 7.2 - * Version: 1.2.2 + * Version: 1.2.3 * Author: Javier Casares * Author URI: https://www.javiercasares.com/ * Text Domain: wpvulnerability @@ -26,7 +26,7 @@ defined( 'ABSPATH' ) || die( 'No script kiddies please!' ); define( 'WPVUL_PLUGIN_URL', plugins_url( '/', __FILE__ ) ); -define( 'WPVUL_PLUGIN_VERSION', '1.2.2' ); +define( 'WPVUL_PLUGIN_VERSION', '1.2.3' ); define( 'WPVUL_PLUGIN_FILE', __FILE__ ); define( 'WPVUL_PLUGIN_BASE', plugin_basename( __FILE__ ) ); define( 'WPVUL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );