# mlsimport/7.2.1/includes/mlsimport-country.php

MLSImport: IDX Plugin &amp; MLS Plugin for Real Estate Listings, version 7.2.1. 42 lines.

- Page: https://pluginprobe.com/plugins/mlsimport/7.2.1/code/includes/mlsimport-country.php
- Raw: https://pluginprobe.com/plugins/mlsimport/7.2.1/raw/includes/mlsimport-country.php
- Modified: 2026-08-24T14:02:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/mlsimport/7.2.1/code/includes/mlsimport-country.php#L10-L20`.

```php
<?php
/**
 * Country resolution for newly created listings.
 *
 * The parsed listing arrives from the SaaS with the feed's own country under
 * meta.property_country: the Lambda maps the RESO `Country` field into that
 * key and translates ISO codes to full names (Centris's "CA" → "Canada").
 * The WpResidence projection historically hardcoded "United States" over it
 * for every new listing, which mislabelled Canadian imports.
 *
 * Step by step:
 * 1. Read meta.property_country from the parsed property.
 * 2. If the feed sent a non-empty country, keep it.
 * 3. Otherwise return the historical default, "United States", so US feeds
 *    that omit the field behave exactly as before.
 *
 * Kept WordPress-free so the rule is unit-testable
 * (tests/PropertyCountryTest.php) without loading the theme adapters.
 *
 * @package    Mlsimport
 * @subpackage Mlsimport/includes
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Resolve the country name to store for a listing.
 *
 * @param array $property Parsed incoming property (SaaS structure).
 * @return string Full country name for the theme's property_country meta.
 */
function mlsimport_property_country( $property ) {
	$country = $property['meta']['property_country'] ?? '';
	if ( is_string( $country ) && '' !== $country ) {
		return $country;
	}

	return 'United States';
}

```
