The METAR and TAF WordPress Plugin

We’ve looked at various means in which to display aviation METAR or TAF (Terminal Area Forecast) data on your WordPress website in the past. However, the hurdles required to overcome the mild complexity involved with editing various files and messing with code often prohibits a lot of people from using the functionality we describe – or so we’re told. The solution: Another WordPress plugin.

METAR does what the functions we’ve formerly provided will do — display raw aviation data. The difference is that we now provide the options of including specific elements of a report rather than the whole thing. While we’ve launched it with just temperature and QNH (altimeter), we’ll be deploying additional versions in the near future that’ll make all sorts of interesting weather related data available, including all the other elements of a METAR or TAF report.

Note that we’re caching the examples on this page for up to a few hours to avoid making unnecessary requests to NOAA’s source website. The reports are not accurate.

The Metar and TAF

As we’ve seen before, once installed, the following line of code will render a current Sydney METAR report into your WordPress website.

[metar loc="yssy"]

The result:

TTF METAR YSSY 281900Z 31009KT CAVOK 11/07 Q1019 RMK RF00.0/000.0 NOSIG

To show a TAF report for JFK (New York), we’ll use [taf loc="kjfk"]. The result:

TAF KJFK 281725Z 2818/2924 18009KT P6SM SCT250 FM281900 18012KT P6SM SCT250 FM290100 18007KT P6SM SCT250 FM290600 17005KT P6SM OVC150 FM290800 17005KT 2SM BR VCSH SCT005 BKN040 TEMPO 2908/2912 4SM SHRA BR BKN005 BKN040 FM291400 24009KT P6SM FEW025 BKN100 FM291700 25015G23KT P6SM FEW040 BKN250 FM292200 30010KT P6SM FEW040 BKN250

The only two available shortcode attributes for a Metar report are loc and cache. The cache is set to keep METAR results for an hour by default (cache="3600"). To increase this to two hours (7200 seconds), for example, use [taf loc="kjfk" cache="7200"] or to retrieve a new result every 15 minutes, use [taf loc="kjfk" cache="900"].

The location must be a valid 4-digit ICAO code (not the IATA code). For example, Sydney is YSSY, not SYD. You can find a list of all available Metar stations here.

Pressure – QNH or Inches of Mercury

To extract the aerodrome pressure from the report, the shortcode of [qnh loc="yssy"] should be used (where yssy is your location of choice). By default, we’ll always return the QNH – not inches of mercury.

The shortcode of [qnh loc="yssy"] will output a QNH of 1019.

A USA METAR report will normally prefix their pressure with an A, for altimeter, while it’s Q in most other parts of the world. Since QNH is the ICAO standard, it defaults to true, regardless of what pressure the report provides.

  • QNH JFK is 1018 [qnh loc="kjfk"]
  • Altimeter JFK is 30.06 [qnh loc="kjfk" unit="0"]

The shortcode provides the value only. Bolding is mine to highlight the result.

Airport Termperature

The temperature (and dew point temperature) on a Metar report is almost always reported in Celsius. The following temperature results are based on data from KJFK. Again, the option to cache your report for longer or shorter than the default hour applies. To cache your report for two hours, use [temperature loc="kjfk" temp="1" cache="7200"], or to cache it for just 30 minutes, use [temperature loc="kjfk" temp="1" cache="1800"].

The bold text in the below results is my own to illustrate the differences between the returned temperatures.

  • Temperature (normalised integer °C) is 21 [temperature loc="kjfk" temp="1"]
  • Dew Point Temp (normalised integer °C) is 16 [temperature loc="kjfk" temp="2"]
  • Raw Temp (from Metar °C) is 21 [temperature loc="kjfk" temp="3"]
  • Raw Dew Point Temp (from Metar °C) is 16 [temperature loc="kjfk" temp="4"]
  • Temperature (°F) (normalised integer) is 70 [temperature loc="kjfk" temp="5"]
  • Dew Point Temp (°F) (normalised integer) is 61 [temperature loc="kjfk" temp="6"]
  • Raw report data is 21/16 [temperature loc="kjfk" temp="7"]

In the examples above, the ‘raw’ temperature will return whatever is provided in the report. Negative temperatures will be prefixed with an ‘M’ and single digit temperatures will include a leading ‘0’.

Installing Metar

To install Metar, you have a few options.

  • Download from the WordPress repository and FTP into your plugin directory, then activate via your control panel.
  • Download from the WordPress repository and upload the zip file into WordPress via the administration panel.
  • Easiest and fastest: Search for “Metar” from within your WordPress plugin dashboard. “Install” then “Activate”. Make sure you download our version, by BeliefMedia .
Plugin Title: Metar
Description: Include global Metar and TAF reports (and individual data) on your website.
Download (downloaded 1730 times) | Plugin Page

If you have problems, leave a comment below.

Showing Metar Reports in Widgets

There’s are a couple of plugins that don’t do anything other than provide a widget for various reports. We’ve avoided this in the first instance because shortcodes give you more freedom in how you format data and seriously flexibility in where you place it.

Since WordPress doesn’t enable shortcodes in Widget areas by default, we’ve provided an option to enable the functionality. Navigate your way to  Settings  Metar Shortcode  (once the plugin is activated) and you’ll see the following option.

If your shortcodes are showing up in Widgets as plain text, and only if they’re showing as text (and not rendering a result), select the option to ‘Yes’ and click  Update » .

You then only have to drag a normal text widget into a sidebar, or another location that supports them, and include your shortcode.

How do I Add the °C or °F part?

We didn’t want to provide °C or °F extension because it limits the way in which you can present data. For example, the temperature in Sydney is currently 11°C (52°F) … but I could also just write that it’s currently 11 degrees.

SYD 11°C

I created the degrees symbol with the string of °.

Features Coming Soon

As with a lot of the plugins we’ll be adding over the next few months, most of them are just to establish a means of eliciting feedback from the people that are most likely to use them. That said, the following features will likely be added in the next release.

  • While widgets are limiting, we’ll likely add them for those few that’ll use them.
  • Add other elements of both METAR and TAF reports: wind, weather, cloud etc.
  • Add (US) PIREPs as reported by .
  • Add reports not provided by NOAA. Bankstown (YSBK), in Australia, for example.
  • Include traditional weather forecasts.

Download, Support & Suggestions

Download the plugin below or, as suggested, install it directly from within WordPress.

Plugin Title: Metar
Description: Include global Metar and TAF reports (and individual data) on your website.
Download (downloaded 1730 times) | Plugin Page

If you have any specific feature requests or suggestions, please let us know.

Version 0.2 – 18th December, 2015

Changes and considerations in Version 0.2 are as follows:

  • We’ve rewritten chunks of code to prepare for widgets, and to make obtaining reports more efficient.
  • Any Australian report is now obtained from the Bureau of Meteorology website. This means you can obtain a report for any Australian METAR/TAF, or ARFOR.
  • ARFORs should be obtained with the shortcode of [sc]arfor loc=”21″[/sc] where 21 is the area you wish to query.
  • For Australian reports only, you can render a TAF or METAR with the line breaks included (as intended) by using tidy="0". We wrap everything into one string by default.
  • We’ve added the option to remove paragraph tags (as is the case with the naked shortcode function). To render reports inline use p="0".
  • All existing reports in your website will be unchanged.
  • To include a degrees symbol (°) alongside temperatures, use degrees="1" in your temperature shortcode.
  • Consideration needs to be made to any copyright that the BOM might apply. Any Australian report needs to be accompanied with a operational disclaimer citing the source.

The next release should be far more comprehensive.

Shortt URL for this post:

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *