We built DEV3 AI Directory & Listings as a WordPress plugin in PHP with a React admin and a light storefront script. It covers the parity features of the leading directory plugins (custom types and fields, maps, front-end submission, paid plans, claims, reviews, bookmarks, messages, alerts and schema.org markup) and adds AI where it saves owners and admins real typing.
Key design decisions
- Structured data before AI.
Page_Extractor reads JSON-LD (including @graph), Open Graph and meta tags, tel: and mailto: links and social profile links. It ranks entity nodes such as CafeOrCoffeeShop above WebPage and breadcrumbs, and converts both openingHoursSpecification and the short Mo-Fr 08:00-18:00 form into the plugin's hours format.
- A response schema per directory type. Each directory type has its own fields (18 field types).
Autofill::schema() builds the Google Gemini API response schema from them at request time: objects for address, hours and social links, a yes/no/unknown enum for checkboxes, and a maxLength on every string.
- Rules win, AI fills gaps. A value found in structured data is never overwritten by the model. Select options and categories must match the site's own labels, and every AI value goes through the same field sanitiser as a human edit.
- Drafts only. Autofill, descriptions, review summaries and duplicate checks all return drafts. Nothing is written until an owner or admin accepts it.
- Works without AI. With no API key, URL autofill still maps structured data, review moderation uses rules (links, spam words, abuse, copied text, self-reviews, bursts from one device), and a built-in parser handles searches such as "open now near the station".
- Safe fetching. Pages are fetched with
wp_safe_remote_get after wp_http_validate_url, with a 15-second timeout, at most 4 redirects and a 2 MB response cap. Uploaded documents are limited to PDF, JPG, PNG, WebP or TXT under 8 MB.
Architecture
Listings are a custom post type with field values in post meta. A dev3dl_index table holds geo, rating, featured, price, event start and hours for fast filtering and "open now" checks. Search narrows candidates with WP_Query and finishes distance, rating and hours filtering in PHP. Maps use Leaflet and OpenStreetMap by default, or Google Maps with a key. Plans can be paid through Stripe Checkout, WooCommerce (HPOS and block checkout) or offline. The API client, encryption, rate limiting, background jobs and usage logs come from a shared core used across DEV3's plugins.