SYSTEM ARCHITECTURE

WordPress RETS Import Plugin Technical Overview

System Overview

Core Purpose

WordPress plugin that imports real estate property data from RETS/MLS systems and automatically processes images, tags, and categorization.

Primary Users

Real estate professionals, property management companies, and MLS data integrators who need automated property listing management.

Key Benefit

Eliminates manual property data entry and provides automated processing of images, taxonomies, and search optimization.

High-Level System Architecture

RETS/MLS Server

Property data source

WordPress Plugin

Core processing engine

AWS S3

Image storage

WordPress Frontend

Public property display

Data flows from RETS servers through the WordPress plugin for processing, with images stored in AWS S3 and final display through WordPress frontend

Core Components

Backend Processing Classes

Esh_Rets_Import_Property

Main property import class handling RETS data processing, image importing, and WordPress post creation

File: classes/class-rets-import-property.php

Esh_Rets_Import_Entity

Abstract base class providing common import functionality for all entity types (properties, agents, agencies)

File: classes/class-rets-import-entity.php

Esh_Property

Property entity class managing WordPress post operations and field definitions

File: classes/class-property.php

Esh_Schedule

Scheduling system for automated imports using WordPress cron

Referenced in functions.php

Frontend & Admin Components

Admin UI (rets.js)

jQuery-based admin interface with AJAX functionality, Select2 integration, progress tracking, and field management

File: rets.js

WordPress Taxonomies

Custom taxonomies for property categorization: property_category, property_tag, property_type, property_area

Registered in functions.php

Image Processing

AWS S3 integration for image storage with automatic renaming and optimization

Multiple classes and functions

Logging & Monitoring

Comprehensive logging system with database tracking for imports, errors, and performance monitoring

Esh_Rets_Logger and custom tables

Data Flow Architecture

Property Import Process Flow

1

RETS Query

Search RETS server for properties

2

Data Processing

Clean and validate RETS data

3

WordPress Post

Create/update property post

4

Auto Processing

Tags, categories, images

5

Final Output

Live property listing

Image Processing Workflow

RETS Image Fetch

  • • GetObject() call to RETS
  • • URL or binary content
  • • Content type detection

Auto Renaming

  • • Address-city-mls-index format
  • • sanitize_title() cleaning
  • • URL-safe filename

AWS S3 Upload

  • • Bucket: property-mls-images
  • • Public-read ACL
  • • Content-Type preserved

WordPress Integration

  • • Gallery meta field update
  • • Featured image assignment
  • • Public S3 URL storage

Technical Stack & Dependencies

Core Technologies

PHP 7.4+

Object-oriented PHP with WordPress hooks, CRUD operations, and session management

WordPress 5.0+

Custom post types, taxonomies, meta fields, cron system, and admin interfaces

MySQL Database

Custom tables for field mapping, logging, scheduling, and failed upload tracking

Key Libraries & Services

PHRETS Library

PHP RETS client for MLS data integration with Bridge API support

AWS SDK (S3)

Cloud image storage with putObject operations and public URL access

jQuery & Select2

Admin UI interactions, AJAX progress tracking, and enhanced form controls

External Integrations

RETS/MLS Servers

Multiple MLS providers with Bridge API compatibility

Google Maps API

Geocoding for address validation and coordinates

Email Notifications

Error reporting and import status updates

Database Schema Overview

WordPress Core Tables

wp_posts

Property posts with custom post type 'property'

wp_postmeta

Property meta fields (price, address, MLS ID, etc.)

wp_terms / wp_term_relationships

Property categories, tags, types, and areas

wp_term_meta

Category metadata (breadcrumbs, area info, etc.)

Custom Plugin Tables

estatik_houzez_classes_active_fields

Field mapping between RETS and WordPress

estatik_houzez_property_sold_history

Price history tracking for properties

rets_server_request_log

RETS query logging and debugging

post_failed_uploads

Failed image upload tracking for retry

Key Database Relationships

Property → Meta Fields

  • • fave_property_mls_id (unique identifier)
  • • fave_gallery (serialized image URLs)
  • • fave_profile_uid (RETS connection ID)
  • • fave_custom_keyword (search optimization)

Property → Taxonomies

  • • property_category (hierarchical areas/types)
  • • property_tag (features and attributes)
  • • property_type (House, Condo, Townhouse)
  • • property_city (geographic location)

Performance & Scalability

Optimization Strategies

Queue Processing

Batch image imports via WordPress option storage to prevent timeouts

Rate Limiting

2-second delays between image downloads to avoid RETS server throttling

Caching Strategy

WordPress object cache for RETS field metadata and taxonomy terms

Selective Updates

Photo timestamp comparison to avoid unnecessary image re-processing

Scalability Features

Multiple RETS Profiles

Support for multiple MLS connections with profile-based isolation

Scheduled Imports

WordPress cron-based automation with configurable intervals

Error Recovery

Failed upload tracking with retry mechanisms and detailed logging

Memory Management

Chunked processing and immediate cleanup to handle large datasets

Security & Data Protection

Input Validation

  • URL sanitization removes null bytes and validates format
  • Image content validation using imagecreatefromstring()
  • WordPress nonce verification for admin actions
  • RETS field sanitization with sanitize_title()

Access Control

  • WordPress capability checks for property editing
  • RETS profile isolation by user permissions
  • S3 bucket public-read ACL for images only
  • Database credential protection via WordPress constants

🔒 Critical Security Notes

  • • RETS credentials stored in WordPress database with encryption recommended
  • • AWS S3 credentials should use IAM roles with minimal permissions
  • • Image uploads limited to validated URLs and content types
  • • All database queries use prepared statements via WordPress WPDB
← Return to Main Documentation