Format an address from address, city, state, zip, country, and phone. Useful for printing out the address on orders, emails, and more.

`
/**
* Format an address.
*
* @since 1.7.6
*
* @see pmpro_formatAddress
*
* @param string $address The formatted address.
* @param string $name The name.
* @param string $address1 The address 1 field.
* @param string $address2 The address 2 field.
* @param string $city The city.
* @param string $state The state
* @param string $zip The postal code.
* @param string $country The country.
* @param string $phone The phone number.
* @param bool $nl2br Whether to convert \n to
elements.
*
* @return string $address The formatted address.
*/
apply_filters( ‘pmpro_formatted_address’, $address, $name, $address1, $address2, $city, $state, $zip, $country, $phone, $nl2br );
`

Parameters

$address
string
$name
string
$address1
string
$address2
string
$city
string
$state
string
$zip
string
$country
string
$phone
string
$nl2br
bool

Return Value

$address


Source

File: https://github.com/strangerstudios/paid-memberships-pro/blob/master/includes/functions.php

View in Source Code

About Actions and Filters in PMPro

Hooks allow you to extend Paid Memberships Pro without editing any core plugin files. You can use a hook to program custom code that interacts with or modifies code in our plugin, Add Ons, your theme, and even WordPress itself.

There are two kinds of hooks: actions and filters.

  • Action hooks allow you to run new custom code at pre-defined locations.
  • Filter hooks allow you to change or extend existing code by modifying the data and returning it back to the software.

Click here to browse the full database of action and filter hooks available in Paid Memberships Pro. For help extending our Add Ons, refer to the individual Add On's documentation page for a list of available hooks.

For more developer-focused information about Paid Memberships Pro, check out the advanced developer topics documentation.

Was this article helpful?
YesNo