WP Manifestindependent plugin directory
manifest / integrations / myweather

My Weather REST API endpoint

WordPress plugin that displays weather data at REST API endpoint.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/salcode/myweather/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WordPress My Weather REST API Plugin

This plugin uses the OpenWeather One Call API 3.0 to retrieve the weather data for a specific latitute/longitude and expose that information at the WordPress REST API endpoint /wp-json/myweather/v1/weather.

The weather data is cached using a WordPress transient.

Setup

In addition to installing and activating this plugin, you'll need to set the following PHP constants (this can be done in wp-config.php at the root of the WordPress site).

  • SF_MY_WEATHER_API_KEY your personal API key from openweathermap.org
  • SF_MY_WEATHER_LAT the latitude of the forecast location
  • SF_MY_WEATHER_LON the longitude of the forecast location

e.g.

define('SF_MY_WEATHER_API_KEY', 'abc123abc123abc123');
define('SF_MY_WEATHER_LAT', '38.991581');
define('SF_MY_WEATHER_LON', '-74.814407');