function sp_total_active( $username = false, $args = array() ) { if ( $username ) { $params = array( 'timeout' => 10, 'sslverify' => false ); $raw = wp_remote_retrieve_body( wp_remote_get( 'http://wptally.com/api/' . $username, $params ) ); $raw = json_decode( $raw, true ); if ( array_key_exists( 'error', $raw ) ) { $data = array( 'error' => $raw['error'] ); } else { $data = $raw; } } else { $data = array( 'error' => __( 'No data found!', 'shapedplugin' ) ); } return apply_filters( 'sp_total_active', $data ); } $total_active = sp_total_active('shapedplugin'); $plugin_names = array_values( $total_active['plugins'] ); $install = 0; foreach ($plugin_names as &$plugin_name) { $install += $plugin_name['installs']; } echo esc_html($install);