AI Best Practices
How to brief the AI so it produces editable, on-brand, accessible pages instead of a wall of hardcoded markup.
Set the site up before you ask for anything
The AI reads your site before it designs. Give it something to read:
- Design tokens: Design Pages → Design Tokens. Colours, fonts, spacing, radius. Or start from a design system, which sets all of them at once. Each token can carry a usage note, such as "icons only, never body text"; the AI reads them before it designs, and they show under each colour on the Design Tokens screen.
- Business info: phone, email, address, socials, WhatsApp, your rating and the type of business.
- Global sections: header and footer.
Skip this and it will invent a palette, and every page will invent a different one. When a colour change would make text hard to read somewhere on the site (under 4.5:1), the save warns and names the colours and pages.
Business info the pages can print
- WhatsApp: your number with the country code.
{{business:whatsapp_url}}is the link for a button. It opens WhatsApp with your default message and adds a short code for the page at the end (for exampleRef: IMPLANTS), so you can tell which page each conversation came from. A button can have its own message and code:{{business:whatsapp_url:text=Hi, I would like a cleaning|ref=hero}}.ref=offleaves the code out. - Rating: your star rating, number of reviews, where they are and a link to them (
{{business:rating}},{{business:review_count}},{{business:review_source}},{{business:review_url}}). Copy them from your real profile. They are not added to search engine data, because Google does not allow a business to mark up reviews of itself. - Type of business: what search engines see, such as Dentist, Plumber or Restaurant.
- Page reviewers: the people who check your pages, with credential, registration number and a link to their bio. Pick one in a page's sidebar under Reviewed by and add
{{reviewed_by}}where the byline should show. Search engines get the same reviewer, only on pages that show it. The byline follows the site language ("Revisado por" on a Spanish site, and in Portuguese, French, German and Italian), or give a reviewer alabelwith your own words.
Search and tracking settings
Under Settings:
- Conversion tracking (off by default) marks every section and every WhatsApp, call, email, directions, booking and form button for Google Tag Manager. It sends a
section_viewevent when a section is half on screen, and a click event when one of those buttons is pressed (WhatsApp, call and directions clicks also get events of their own), so each button has a click rate next to its view rate. Sections are named in reports by their role (hero, pricing, call to action) when they have one, so figures line up across sites built on the same design. Nobody types the marks, and ones you wrote by hand are kept. One small script does it for the whole page, loaded after the page has drawn. - Tag Manager container (Settings → General → Tracking and search results): put your container id here, for example
GTM-XXXXXX. It is passed to the page, but the plugin does not load Tag Manager for you. - To leave a section or button out of tracking, give it a
data-ppd-no-trackattribute. To count an extra button as a lead, adddata-ppd-cta, for exampledata-ppd-cta="book". - FAQ in search results (on by default) sends search engines the FAQ straight from the page every time it is shown, including FAQs built by hand: questions that open and close, in a section whose role is FAQ, whose name says FAQ, or inside an element with
data-ppd-faq. If Rank Math has an FAQ saved in its Schema tab for that page, that saved copy is no longer printed, so the two can't disagree. An FAQ written by hand in the page's schema field, or an FAQ block in the post body, still wins. The page check (validate_page) says where a page's FAQ schema comes from. - Host fonts on this site copies the design's Google fonts to your site and loads them from there. The page then makes no request to Google, preloads the heading and the text font, and sizes the stand-in font so the text doesn't jump when the real one arrives. It also works when the design's fonts include a system font stack.
{{breadcrumbs}}follows your page structure and describes the same trail to search engines, unless Yoast or Rank Math already does.
View full sizeBrief it like a designer, not like a search box
Weak: "make a homepage"
Better: "Homepage for a family dental practice in Portland. Warm and calm, not clinical. Sections: hero with a booking CTA, three services, meet-the-dentist with a photo, two patient testimonials, insurance logos, contact with the CF7 form. Keep every headline and body paragraph editable."
Say what sections you want, what the page is for, and who edits it afterwards.
Rules the AI is given
Content
- Benefit-driven headlines, never "Welcome to our site".
- Action-oriented CTAs — "Start Free Trial", "Get Your Quote" — never "Submit" or "Click Here".
- Use social proof: testimonials, stats, logos, trust badges.
- Break up text with subheadings and bullets.
- One clear purpose per section.
SEO
- Exactly one
<h1>per page, used for the main headline. - Descriptive, keyword-bearing
<h2>/<h3>section headings. - Real structured content — lists and paragraphs, not divs full of text.
- Meaningful alt text on every image.
- Descriptive anchor text on internal links.
- Important content above the fold.
Accessibility
- WCAG AA contrast: 4.5:1 body, 3:1 large text.
- Everything interactive reachable by keyboard, with a visible focus indicator.
aria-labelon icon-only buttons.- Labels associated with form inputs.
- Never convey information by colour alone.
- A skip-to-content link on long pages.
Performance
- Shallow DOM — minimise nested divs.
- CSS for visual effects (gradients, shadows, shapes), not images.
- No inline styles; use
scoped_css. - Low CSS specificity, class selectors.
- Images are optimized automatically at render time —
srcset,sizes,width,height,loadingandfetchpriorityare injected for you. Don't hand-roll them.
Workflow
- For complex components (timelines, tabs, pricing tables, bento grids, accordions, carousels), call
get_component_templatesfirst and start from the proven skeleton. Don't build them from scratch. - Contact sections:
get_component_templates(type="contact"). Embed your form plugin, or use the no-form variant. Never a hand-written form. - Pull an image in from a web address with
import_image(name, alt text and featured image in one step).list_mediasearches what's already in the Media Library, so reuse before importing. A picture WordPress renamed on upload (because the name was taken) is found under either name; itsoriginal_filenameis the one you uploaded. update_mediachanges the alt text, title, caption or description of up to 50 media items in one call, without placing them anywhere. Only the fields you send change.- A post template (template assignment) needs a published Design Page. A draft is refused with the reason. Template pages stay hidden from visitors either way.
- Search engine extras (video, FAQ and recipe rich results) go in the page's
page_schema. - For CSS fixes, use
css_overridesinpatch_sectionrather than resending the wholescoped_css. It saves 60 to 80% of the tokens on iterative edits. patch_sectionfor surgical changes (a headline, one CSS rule).replace_sectiononly when the whole structure changes.- Give every section a role (faq, steps, services and so on) with
set_section_role. The role decides which sections are offered in its place, and which ones search engines get as an FAQ. - The design tools behind the editor's Section and Site design tabs:
get_section_options(what a section can become),swap_section_layout(swap it),set_section_style(its own look or tokens). Sections takeground(page, soft, brand, contrast) andheading(smaller, larger). The site's text size is the tokentype.scale(0.92, 1, 1.1 or 1.2). get_best_practiceshas topics for special jobs:health(health copy, reviewer bylines, review sources, disclaimers),seo(answer first, headings written as the questions people search, meta descriptions,{{business:whatsapp_url}}) andtracking(the full dataLayer contract).
The habit that matters most: keep it editable
Every headline and paragraph a human might ever change belongs in a content field, not baked into
template_html. The plugin warns the AI when a section is too hardcoded, but a clear brief prevents it
in the first place. Ask for a content_fields_schema too — that's what turns Content Mode into a properly
labelled form.
Repeating items and optional parts
Lists of cards, steps or rows don't need one hand-numbered block per item. A repeat block renders one copy per field set:
{{repeat:s}}<a href='{{s#_url}}'>{{s#_title}}</a>{{/repeat}}
That prints one card per s1_…, s2_… field set. {{if:eyebrow}}…{{/if}} drops an element whose field is empty ({{else}} is optional). Add or remove an item by adding or emptying its fields; the section editor has an Add item button.
Section anchors: patch_section(anchor: "watch") gives a stable #watch link. list_icons(search: "…") searches every Phosphor icon.
Working alongside the AI safely
- Edit locks: MCP writes honour WordPress post locks. If someone has the page open you get a
409 post_lockedrather than a silent overwrite. Only force it when you know what you're overwriting. - Old edit tabs: if your AI changed a page after you opened its WordPress edit screen, clicking Update on that screen no longer writes the older sections back. The newer page is kept, and anything you changed on that screen is saved in the page history.
- Section versions:
if_versiongives optimistic locking at section level, so two editors on the same page can't overwrite each other. Two AI writes to the same page wait their turn. - Attribution: pass an
actorwhen your client knows who the real human is. It appears in the revision history above the token owner. Don't invent one. - AI Notes: the AI can flag an assumption for a human to confirm instead of guessing. They show under AI Notes in the Design Pages menu, in the page sidebar and in the admin bar. Use them; that's what the channel is for.
- Read-only connections: for an assistant that should review but never change anything, approve its sign-in as Read only.
- Two builders: if Vision Builder Control is also installed, answer the builder question when the assistant asks it. Don't let the assistant switch plugins to avoid it.
- One change everywhere:
bulk_replace_textfinds and replaces one piece of text across post bodies, page sections, shared sections, the header, the footer and menus. The first call only lists the matches; send it again withdry_run: falseto write. - Build timeline: Settings → Advanced keeps a log of the last 5,000 AI calls (tool, time and size, never content), with a download. Useful to see where a long build spent its time.
Iterating
Preview after each meaningful change (get_preview_url). The link opens without a login, stays the same across edits and reloads itself after every change the AI saves, so you can keep it open beside the chat (see Live preview). It lasts a day unless you ask for longer: days takes 1 to 30, and the reply gives expires_at. allow_notes: true lets the person you send it to leave notes. revoke_preview_url ends it early.
Run validate_page too. It catches icon-name typos, broken image URLs, malformed CSS, images it can't match to the Media Library or that WordPress has shrunk, fields that will print their markup as text, dead forms, and broken video embeds. Validation returns warnings, not errors; pages save either way.
- Video links. A YouTube watch or share link (youtu.be) or a Vimeo page link in a video frame shows a blank box. The page check flags it and gives the embed address to use.
- Sample photos. An image that is still a design system's stock sample photo is named as one, so it is easy to tell from a photo you added.
- Page weight. A page over 1 MB is flagged with its biggest files, as are a slider or video at the top of the page, a top photo set as a CSS background or loaded late, and scripts loaded from other sites. A picture in an
<img>counts at the size a phone downloads; a CSS background picture counts at full size.
Video and map embeds load only when a visitor asks: YouTube and Vimeo frames show the video's thumbnail with a play button, and a Google map shows a drawn map with a Show map button. Add data-ppd-poster="<image URL>" to a video frame to show your own picture instead. Add data-ppd-map-image="<picture URL>" to the map's iframe to show your own picture of the area, or data-ppd-no-facade to load it straight away.
Edits clear page caches automatically. bust_cache clears every layer it can reach and reports the rest; add warm=true to rebuild and confirm. A CDN still needs its own purge.
Let the AI check its own page
After a build, ask the AI to check the page. Its preview tool (render_page) reports text that's hard to read on its background, three or more columns squeezed onto a phone, anything wider than a phone, text that only appears once a script runs, buttons that jump to a section that isn't on the page, links that go nowhere and images with no description. It also returns a short outline of each section: its background, how many cards sit side by side on a computer and on a phone, and its text in order. That's how the AI confirms the page matches your brief without reading thousands of lines of HTML, and it can look at one section at a time on a large page.
The check works from the page's code, not a screenshot, so a problem it finds is real, but a clean result doesn't prove the page looks right. Look at it yourself before you publish.
Shared styles get a confirmation too. When a change to a shared button, card or label style would change how other pages look, nothing is saved until the AI has told you which pages and you agree.