Skip to content
Docs
Get RestroPress

Filter

rpress_us_states

Updated
On this page

Filters the list of states returned for United States.

Applied at the end of rpress_get_states_list(), which rpress_get_states() calls when the selected country is US. The array maps a code to a display name (state code => name; includes territories and armed forces entries). Add, remove or rename entries to change what appears in the state selector for this country.

Parameters#

ParameterTypeDescription
$statesarrayAssociative array of state code => name; includes territories and armed forces entries.

Return value#

array. The list of states for United States.

Example#

function my_add_us_states( $states ) {
	$states['XX'] = 'My Custom Region';
	return $states;
}
add_filter( 'rpress_us_states', 'my_add_us_states' );

Source#

Applied in:

  • includes/country-functions.php (line 468), in rpress_get_states_list()

See also#

Was this page helpful?