WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Geodata


WordPress does not include any geographic functionality or functions to deal with Geodata itself (something that might be called a Geodata API). But there is a standard for how to store geodata, so that plugins can interoperate.

Where to store Geodata ?

Geodata for an object should be stored in the metadata for that object.

  • Geodata for posts, pages and other post-types should be stored in postmeta.
  • Geodata for users should be stored in usermeta.
  • Geodata for comments should be stored in commentmeta.

Geodata Format

Meta keys and their meta values are listed below.

geo_latitude REQUIRED
(float) decimal degrees -90 to 90 (negative values are in the southern hemisphere).
geo_longitude REQUIRED
(float) decimal degrees -180 to 180 (negative values are in the western hemisphere).
geo_public OPTIONAL
(int) is the geodata public (1) or private (0)? If value is missing, assume public.
geo_address OPTIONAL
(string) freeform textual description of coordinates.
"221B Baker St, Westminster, London NW1 6XE, UK",
"Pasadena, CA", "Soho, NYC", "Idaho", etc.
Accuracy level and language is arbitrary.