4WP Weather

Description

4WP Weather adds a block for current conditions on your site. Choose a provider, store your API key in WordPress (never in the browser), and load data through the REST API with server-side caching.

A plugin by 4wp.dev. 4WP is our project brand; the letters “WP” appear only as part of that brand name, not as a reference to WordPress. This plugin is not affiliated with, endorsed, or sponsored by WordPress.

Source code and releases: github.com/4wpdev/4wp-weather

Development

JavaScript and CSS are built with @wordpress/scripts. The plugin ZIP includes human-readable source (src/, package.json, webpack.config.js) plus compiled build/. The same tree is mirrored on GitHub for development and releases.

  1. cd into the plugin directory
  2. npm install
  3. npm run build — outputs build/weather/ and build/admin/

Key features

  • Gutenberg block forwp/weather with OpenWeatherMap (more providers on the roadmap)
  • React admin: Providers (API key, live preview) and Documentation
  • Server-side upstream requests; optional JSON-LD (Observation)
  • WP-CLI: wp forwp-weather flush-cache

Privacy

The API key is stored as a WordPress option and is not exposed to front-end HTML or JavaScript. The block calls forwp-weather/v1/weather; PHP performs the remote request. See External services below for what is sent to OpenWeatherMap.

External services

This plugin connects to the OpenWeatherMap Current Weather API to fetch conditions shown in the weather block, admin live preview, and optional JSON-LD.

When a visitor loads a page with the block (or when an administrator uses the live preview), WordPress sends a server-side HTTPS request to https://api.openweathermap.org/data/2.5/weather. The request includes:

  • Your stored API key (appid query parameter), configured in the admin.
  • Either geographic coordinates (lat, lon) from the block attributes, from browser geolocation when the visitor allows it, or a default location you configure.
  • Or a city name (q) when a text location is configured instead of coordinates.

This plugin does not send visitor IP addresses in the API request. OpenWeatherMap may log requests according to their own policies. Responses are cached on your server (WordPress transients) to reduce repeat API calls.

This service is provided by OpenWeather Ltd. (OpenWeatherMap):

  • Terms of use: https://openweathermap.org/terms
  • Privacy policy: https://openweather.co.uk/privacy-policy

Blocks

This plugin provides 1 block.

  • 4WP Weather Weather snippet with pluggable providers (OpenWeatherMap live; others registered as roadmap stubs).

Installation

  1. Upload the plugin to /wp-content/plugins/4wp-weather/ or install from the Plugins screen.
  2. Activate 4WP Weather.
  3. Open 4WP Weather in the admin menu Providers, set provider and API key, then save.

FAQ

Does the API key appear in the browser?

No. Only WordPress talks to the weather API using the stored key.

Is JSON-LD required?

No. Enable it under Documentation if you want structured data on public pages. There is no guarantee of rich results in search engines.

Which providers work today?

OpenWeatherMap is live. Additional providers are registered for future releases.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“4WP Weather” is open source software. The following people have contributed to this plugin.

Contributors

Translate “4WP Weather” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0.0

  • Initial release: weather block, OpenWeatherMap, REST API, cache, admin UI, optional JSON-LD.