Last updated July 11, 2026, Version 0.34
When you edit a venue, the Address field in the Venue Details block offers
autocomplete suggestions from Photon (the OpenStreetMap-based geocoder that
GatherPress proxies). Each suggestion is a one-line, postal-style label such as
42 Hauptstraße, Berlin, 10115. Picking a suggestion writes that label into the
venue’s address.
By default the street portion of that label is formatted as
{house number} {street} (for example 42 Hauptstraße). German-speaking and
several other locales conventionally place the house number after the street
name (Hauptstraße 42). The
gatherpress_geocode_street_line filter lets
you reorder those two pieces.
gatherpress_geocode_street_line
Filters the street line (house number plus street) used when GatherPress builds an address autocomplete suggestion label.
| Parameter | Type | Description |
|---|---|---|
$street_line |
string |
The default street line, "{house number} {street}" (for example "42 Hauptstraße"). |
$housenumber |
string |
The house number on its own. May be empty. |
$street |
string |
The street name on its own. May be empty. |
The filter returns the street line as a string. GatherPress trims the returned
value; if it comes back empty, the label falls back to the feature’s name
property.
Reorder unconditionally
The simplest use is to always place the house number after the street:
add_filter(
'gatherpress_geocode_street_line',
static function ( string $street_line, string $housenumber, string $street ): string {
// Leave partial results (name-only or a missing piece) untouched.
if ( '' === $housenumber || '' === $street ) {
return $street_line;
}
return trim( $street . ' ' . $housenumber );
},
10,
3
);
Reorder only for German locales
To match the locale convention from
issue #1833, gate the
reorder on get_locale() so only German-speaking sites (de_DE, de_AT,
de_CH, and so on) are affected:
add_filter(
'gatherpress_geocode_street_line',
static function ( string $street_line, string $housenumber, string $street ): string {
if ( '' === $housenumber || '' === $street ) {
return $street_line;
}
if ( ! str_starts_with( get_locale(), 'de' ) ) {
return $street_line;
}
return trim( $street . ' ' . $housenumber );
},
10,
3
);
Scope and limitations
- The filter only changes the suggestion label shown in the editor’s address
autocomplete. That label becomes the savedgatherpress_addresswhen a user
selects a suggestion, so the saved address follows the order you return. - It does not change the structured address meta (
gatherpress_house_number,
gatherpress_street, and the rest). Those are stored as separate fields and
are not reordered. - It only affects the street portion of the label. The locality, region, and
postcode are appended after it, comma-separated, and are not touched by this
filter. - An address a user types by hand (rather than choosing a suggestion) is stored
verbatim and never passes through this filter.
See also
- Hook naming convention
- The auto-generated per-hook reference under
docs/developer/hooks/(regenerated by CI on merge).