We built DEV3 AI Event Writer as a WordPress plugin in PHP with React panels that appear in three places: a sidebar in TEC's block editor, a metabox in the classic editor, and an admin app for bulk work. Every output is stored as a pending draft in its own table and shown as a diff against the current value.
Key design decisions
- TEC-aware facts. One adapter reads title, dates with timezone, cost, venue, organizers, categories and, with Event Tickets, ticket types and attendee counts. Prompts receive those facts, so nothing is retyped and the model is told never to invent prices, dates or speakers.
- Drafts that keep TEC's blocks. Accepted descriptions become native core blocks that replace only the text blocks; TEC's date, price, venue, organizer and ticket blocks stay where they are. Classic events get HTML. If the event changed after a draft was written, accepting asks for confirmation first.
- Flyer import with review. A JPG, PNG, WebP or PDF flyer goes to the vision model in a background job. The structured answer is re-validated on the server (real dates, 24-hour times, valid timezone, valid email), and fields the model marked as missing or uncertain are flagged in the form.
- Venue and organizer matching. Before anything is created, the draft's venue and organizer are scored against existing records by normalised name, city, address, email and website domain. A match of 80 or more is suggested as "use existing"; the admin can switch to "create new" or "none". The event is created as a draft through TEC's own ORM.
- Channel rules on the server. Social posts are trimmed to each network's limit, with X links counted as 23 characters. Recaps receive attendance counts only, never names or emails, and this is unit-tested.
- Useful with AI off. Template drafts, manual editing and manual flyer entry with the same matching all work without a key.
Architecture
Drafts and imports live in two custom tables; accepted social posts, emails, FAQs and SEO meta are post meta on the event. Bulk runs and flyer reads use the shared background job runner with progress, cancel and retry. Emails can be test-sent, sent once per unique Event Tickets attendee, or sent automatically as a reminder before the event. The FAQ renders on the event page with FAQPage schema, and SEO meta goes into Yoast SEO or Rank Math when active, or is printed by the plugin otherwise. The API client, settings, jobs and usage logs come from a shared core used across DEV3's plugins.