Comprehensive analysis of AUTO TAGGING, AUTO IMAGE RENAMING, and AUTO WP CATEGORIZATION processes
This audit specifically analyzes the three key automated processes that handle property data transformation and organization within the WordPress ecosystem.
The auto-tagging system automatically creates and assigns property_tag taxonomy terms based on RETS field values and property descriptions. This process enhances search functionality and property categorization.
// PRIMARY TAGGING FUNCTION
function esh_set_property_tag($rets_field, $value, $property_id)
{
if (!empty($rets_field->system_name) && !empty($value)) {
$tags = [];
switch ($rets_field->system_name) {
// Bedroom count tagging
case 'LM_Int1_4':
case 'BedroomsTotal':
$tags[] = sprintf(_n('%s Bedroom', '%s Bedrooms', $value), $value);
break;
// Bathroom count tagging
case 'LM_Int1_19':
case 'BathroomsTotalInteger':
$tags[] = sprintf(_n('%s Bath', '%s Baths', $value), $value);
break;
// Laundry features
case 'LaundryFeatures':
if ($value == 'In Unit') {
$value = 'In Suite Laundry';
}
$tags[] = $value;
break;
default:
// Generic comma-separated values
if ($value !== 'None') {
$value = explode(',', $value);
if (!empty($value)) {
$tags = array_merge($value, $tags);
}
}
break;
}
if (!empty($tags)) {
wp_set_object_terms($property_id, $tags, 'property_tag', true);
}
}
}
In class-rets-import-entity.php during field processing loop
if ($field->associate == 'property_tag') {
esh_set_property_tag($field, $value, $this->_entity->getID());
}
Property tag taxonomy with custom URL rewrite
register_taxonomy('property_tag', 'property', [
'rewrite' => [
'slug' => 'mls/tag',
'with_front' => false,
],
]);
| RETS Field | Purpose | Tag Format | Example Output |
|---|---|---|---|
| LM_Int1_4, BedroomsTotal | Bedroom count | "{count} Bedroom(s)" | "3 Bedrooms" |
| LM_Int1_19, BathroomsTotalInteger | Bathroom count | "{count} Bath(s)" | "2 Baths" |
| LaundryFeatures | Laundry amenities | Transform "In Unit" → "In Suite Laundry" | "In Suite Laundry" |
| Default (any other field) | Generic features | Comma-separated array | ["Pool", "Garage", "Patio"] |
The auto image renaming system standardizes property image filenames using address, city, MLS ID, and index before uploading to AWS S3 storage. This prevents conflicts and creates SEO-friendly, descriptive filenames.
// Bridge API Naming (RETS 1.9+)
if ($is_bridge_api) {
$street_number = $this->_data['StreetNumber'];
if (!empty($this->_data['StreetDirPrefix'])) {
$street_number = $street_number . ' ' . $this->_data['StreetDirPrefix'];
}
if (!empty($this->_data['UnitNumber'])) {
$street_number = $this->_data['UnitNumber'] . ' ' . $street_number;
}
$image_name = sprintf('%s-%s-%s-%s',
$street_number . ' ' . $this->_data['StreetName'] . ' ' . $this->_data['StreetSuffix'],
$this->_data['City'],
$this->_data['ListingId'],
$key // Image index
);
} else {
// Legacy RETS naming
$image_name = sprintf('%s-%s-%s-%s',
$this->_data['L_Address'],
$this->_data['L_City'],
$this->_data['L_DisplayId'],
$key
);
}
// Sanitize for URL-safe filename
$image_name = sanitize_title($image_name);
Used as S3 object key
$data_array = [
'Bucket' => 'property-mls-images',
'Key' => $image_name,
'Body' => $image_content,
'ACL' => 'public-read',
];
$result = $s3->putObject($data_array);
| API Type | Address Fields | City Field | MLS ID Field | Example |
|---|---|---|---|---|
| Bridge API |
UnitNumber + StreetNumber + StreetDirPrefix + StreetName + StreetSuffix |
City | ListingId | 302-123-main-st-toronto-n12345-0 |
| Legacy RETS | L_Address | L_City | L_DisplayId | 456-oak-ave-vancouver-v67890-1 |
The auto categorization system creates hierarchical WordPress taxonomy structures for properties based on RETS data. It generates area/subarea categories, property type categories, and SEO-friendly URL slug structures for organized property browsing.
register_taxonomy('property_category', 'property', [
'hierarchical' => true,
'rewrite' => [
'slug' => 'mls',
'with_front' => false,
],
]);
URL: /mls/{category-name}/
register_taxonomy('property_tag', 'property', [
'hierarchical' => false,
'rewrite' => [
'slug' => 'mls/tag',
'with_front' => false,
],
]);
URL: /mls/tag/{tag-name}/
// Property class determination for Bridge API
if ($property_type == 'Residential' && strpos($structure_type, 'Residential Detached') !== false) {
$property_class = 'RD_1';
} elseif ($property_type == 'Residential' && strpos($structure_type, 'Residential Attached') !== false) {
$property_class = 'RA_2';
} elseif ($property_type == 'Residential Income') {
$property_class = 'MF_3';
} elseif ($property_type == 'Land') {
$property_class = 'LD_4';
}
// Type assignment based on dwelling type
if (($property_class == 'RD_1' || $property_class == 'RA_2')) {
if ($type_of_dwelling == 'Townhouse') {
$type = 'Townhouses';
} elseif ($type_of_dwelling == 'Apartment/Condo') {
$type = 'Condos';
} else {
$type = 'House';
}
}
Creates geographic area terms without property types for autocomplete search
Combines geographic areas with property types (Toronto Condos)
Creates child categories for subareas within main areas
Assigns property_type taxonomy terms for filtering
| Data Component | Bridge API Fields | Legacy RETS Fields | Usage |
|---|---|---|---|
| Area | MLSAreaMajor | L_Area | Main geographic region |
| Sub Area | MLSAreaMinor | LM_Char10_5 | Subdivision within area |
| Property Type | PropertyType, StructureType | LM_char1_36 | Property classification |
| Dwelling Type | PropertySubType | LM_Char10_11 | Specific property style |