Writing

Adding an AI chatbot to WordPress, without another plugin

Most WordPress chat tools are a plugin — another thing to update, another thing that can break. Here is the script-tag version: where to paste it, what to train it on, and which WordPress pages quietly poison the index.

·8 min read

Search “AI chatbot for WordPress” and almost everything you find is a plugin. That is the WordPress default for everything, and for most things it is the right one. For a chat widget it is a strange trade: you are installing PHP that runs on every page load, in order to output about forty characters of HTML.

A chat widget is a script tag. It does not need to hook wp_enqueue_scripts, it does not need an options page, and it does not need to be in your update queue competing with the things that actually touch your database. This is how to add one without any of that, what to point it at, and the two WordPress-specific traps that make an assistant look stupid.

Where the tag goes

Four places, in rough order of how little they can break:

  • A header-and-footer snippet plugin, if you already have one. Most sites do. Paste into the footer field and you are done.
  • Appearance → Customize → Additional CSS is for CSS only, but many themes ship a matching scripts panel. If yours does, use it: it survives theme updates.
  • A Custom HTML block in a reusable block or a footer widget area. Fine, and visible to anybody editing later, which is an underrated property.
  • Your child theme’s footer.php. The classic answer. Only in a child theme — edit the parent and the next update deletes your work.

What to point it at

An assistant answers from what you give it, so the useful question is which of your pages actually answer anything. On a typical WordPress site the ranking is unintuitive: the dull pages win.

  • How long does delivery take? — nothing to answer from
  • Can I return it if it doesn’t fit? — nothing to answer from
  • Is it machine washable? — nothing to answer from
  • Which size am I if I’m 5'9"? — nothing to answer from
  • What do you actually sell?
  • Do you ship to Spain, and what’s the duty? — nothing to answer from
  • My order says delivered but isn’t. — nothing to answer from
1 of 7 answerable — 14%Marketing pages are written to persuade someone who has not decided. Almost nothing a buyer asks after deciding is on them.
Fig. 01Which questions each kind of page can answer— switch sources on and off →↳ on a content site, posts do more work than they look like they will

Shipping and returns pages, the FAQ, pricing, and any how-to post you have written are worth more than the home page and the about page put together. Marketing copy answers very little of what somebody asks after they have already decided to buy.

The two WordPress traps

Archives. WordPress generates a URL for every category, every tag, every author and every page of every listing. They contain excerpts of posts that already exist elsewhere, which means a crawl picks up the same paragraph a dozen times under a dozen addresses. Retrieval then has twelve near-identical passages to choose between and the real post has to fight its own excerpts for a place in the answer. Exclude archive paths, or let the crawler read only what your sitemap lists.

The page that is mostly furniture. A theme’s page template can wrap three sentences of content in a header, a mega menu, a cookie banner, a related-posts block and a footer with every link on the site in it. Crawled naively, that page is 90% navigation, and the three sentences you wanted are a rounding error in the middle. Any assistant worth using will let you open a source and see exactly which passages it produced — do that once, on your worst page, before you trust any of it.

The honest test is not whether it answers. It is whether you can see where the answer came from and disagree with it.

What it cannot see

It reads your published HTML, exactly as a search engine does, and only what robots.txt allows. There is no database connection, no WordPress user, no REST API token. Drafts, private posts, password-protected pages, customer accounts, WooCommerce orders and anything behind a login are all invisible to it.

That is a limitation and also the reassurance: a thing that cannot reach your admin cannot be talked into leaking it. If you do want live answers — order status, stock, a customer’s own account — that works the other way round, by you exposing an endpoint the assistant may call, with you deciding exactly what it returns.

What it is worth

The case for this is not that AI is exciting. It is that a predictable share of your contacts are the same four questions, those questions are answered on pages you already wrote, and every one that gets answered without you is time back.

800
70%
$8
Conversations handled560240 still reach a person
Contact cost avoided$4,480at $8 each
Net, a month$4,281after $199 for the Business plan
It pays for itself 22.5× overThat is the arithmetic at its most flattering: it assumes every answered conversation would otherwise have cost you a full contact, which is never quite true.
Fig. 02What answering the repeat questions is worth— set your volume and what a contact costs you →↳ the net line is the only one that matters

The second return is less obvious and tends to outlast the first: every question it could not answer is a gap between what you published and what people want to know, in their words rather than yours. On a WordPress site that list usually turns into three posts you would never have thought to write.

Trying it on your own site

Point it at your domain, let it read what robots.txt allows, exclude your archive paths, and paste one tag into the footer. The free 25 replies are enough to ask it the four questions you answer most and find out whether your own pages actually contain the answers. They usually do — in words nobody would search for, which is its own useful finding.

Common questions

Do I need a plugin to add an AI chatbot to WordPress?
No. A chat widget only needs one script tag, which you can paste into your theme's footer, the Customizer, a block, or any header-and-footer snippet plugin you already have. A dedicated plugin adds PHP to every page load and another update to track, for markup you could have added once.
What should an AI chatbot read on my WordPress site?
Pages and posts that answer questions: shipping, returns, pricing, how-to guides, FAQ pages and product pages. Skip tag archives, category archives, author pages and paginated listings — they repeat the same text under different URLs and crowd the real page out of the results.
Can an AI chatbot access my WordPress database?
It reads the published HTML, the same as a search engine, and only what robots.txt allows. It does not connect to your database, cannot see drafts, private posts, user accounts or anything behind a login, and it has no WordPress credentials of any kind.
wordpressguidetraining

Try it on your own content

25 free replies, no card. Point it at your site, ask it the three questions you answer most, and read what it says.

Read next

metrics·11 min read·2 figures to try

How to measure an AI support assistant

A deflection rate is a definition before it is a number, and the flattering definition is always available. The four metrics worth tracking, and the containment trade-off a randomised trial actually measured.

retrieval·10 min read·2 figures to try

Why an AI assistant makes things up, and what retrieval fixes

Retrieval cuts invented answers by more than half and does not eliminate them. What the measured numbers are, why a confident wrong answer is the dangerous kind, and what to do about the remainder.

shopify·10 min read·2 figures to try

An AI assistant on a Shopify store: what it can and cannot see

Order status is 18% of ecommerce questions and answering it is a lookup. Here is what an assistant can read from your catalogue, what it must never read, and what the dull questions are worth.

Written by Shardul Gautam, who builds Zinx Chat.