How to Install a Chatbot for WordPress in Under 10 Minutes

A chatbot for WordPress installs as one script tag output on every page, and there are exactly three sane places to put it: a header and footer plugin, a child theme hooked to wp_footer, or the built-in Theme File Editor. Use the plugin unless you already run a child theme. WordPress itself warns that editing theme files directly loses your changes on the next update.

WordPress makes this harder than Shopify or Squarespace for one reason: there is no core admin screen for "put this script on every page". That gap is why the plugin directory has a dozen plugins whose only job is to fill it. Below is which route to take, why, and the exact steps. For the wider question of whether a chat assistant earns its place on your site at all, the ecommerce chatbot guide covers it.

What a chatbot for wordpress is, and what it should answer from

A chatbot for wordpress is a chat window loaded on your WordPress site by a JavaScript snippet, answering visitor questions in place of a contact form. The version worth installing answers from material you supplied rather than from the open internet, so its answers match your actual delivery, returns and pricing terms.

That constraint is the whole product decision behind chatfor.site. The assistant reads only the documents, pasted text, product entries and question-and-answer pairs you gave it, and is instructed to say it does not have something to hand rather than fill the gap with a guess. Ask it who runs the company when nothing in the uploads says so, and it tells you it does not know. You can open any past conversation in the dashboard, see which passages an answer was drawn from, and overrule it.

Worth knowing: Nielsen Norman Group's usability research on chatbots is worth reading before you install one. Its bluntest finding was that "improving the UX of your website or app will bring you higher return on investment than creating a chatbot" (Source: Nielsen Norman Group, 2018). That holds for chatbots that replicate navigation. It does not hold for the case where your answer exists in writing and is buried three clicks deep, which is the case a document-backed assistant is actually for.

Where does a script tag go in WordPress?

Into the footer of every page, output through the wp_footer hook. WordPress documents wp_footer as printing "scripts or data before the closing body tag on the front end" (Source: WordPress developer documentation, 2026), and wp_head as printing "scripts or data in the head tag on the front end". Either works for a deferred widget script. The footer is marginally better because nothing about a chat bubble should sit in front of your content rendering.

The complication is that WordPress gives you no first-party screen for this, and where the theme files live now depends on your theme type. Three routes, ranked.

Route 1: a header and footer plugin (recommended)

The plugin directory's most-installed option for this is WPCode, listed as "WPCode - Insert Headers and Footers + Custom Code Snippets", slug insert-headers-and-footers, reported at over 3 million active installations (Source: WordPress.org plugin directory, 2026). Any plugin in that category will do; the point is that the snippet lives in the database rather than in a theme file, so a theme update cannot remove it and switching themes does not lose it.

This is the right answer for most sites. It survives updates, needs no code, and takes one screen.

Route 2: a child theme hooked to wp_footer

If you already maintain a child theme, add this to its functions.php:

add_action( 'wp_footer', function () {
	?>
	<script
		src="https://chatfor.site/widget.js"
		data-bot-id="YOUR_BOT_ID"
		defer
	></script>
	<?php
} );

WordPress recommends child themes precisely so that "you (or your child theme's users) can still receive updates to the parent theme without losing those modifications" (Source: WordPress developer documentation, 2026). A child theme needs only a style.css with a Template field naming the parent theme's folder.

You may be wondering why this prints raw markup rather than calling wp_enqueue_script. Because the widget needs data- attributes on the tag, and wp_enqueue_script does not put arbitrary attributes there without a script_loader_tag filter on top. Printing the tag is three lines and does exactly what you meant. wp_enqueue_script is the correct tool for a plain script file, and since WordPress 6.3 its $args parameter accepts a strategy key of defer or async (Source: WordPress developer documentation, 2026), but for a tag carrying configuration attributes it is the longer road.

Route 3: the built-in Theme File Editor (last resort)

WordPress ships an editor for theme files, and its location depends on the theme:

  • Block themes: "both the Theme and Plugin File Editor will be listed under Tools" (Source: WordPress developer documentation, 2026).
  • Classic themes: "the Theme File Editor will be listed under Appearance and the Plugin File Editor will be listed under Plugins".

Use it only if you cannot install a plugin and will not make a child theme, and read WordPress's own warning first.

Worth knowing: WordPress documents the Theme File Editor with a genuine warning: "Be very careful editing PHP files of your current theme. The editor does not make backup copies. If you introduce an error that crashes your site, you cannot use the editor to fix the problem." It adds that "Changing files in this manner is not recommended. If you update the theme all of your changes will be lost" (Source: WordPress.org documentation, 2026). Changes through these editors are also live instantly, on the public site, with no staging step.

There is a fourth thing people try, and it is worth naming so you do not: a Custom HTML block inside a single page. That loads the widget on that one page, is subject to the content parser, and is not how you install something site-wide.

The install, step by step

This is the plugin route, which is the one to use unless you have a reason not to.

  1. Create the assistant. Sign up at chatfor.site. Sign-in is a magic link, so there is no password. The Free plan gives one assistant, 25 documents and 100 answers a month, and takes no card.

  2. Upload what it should know. Delivery terms, returns policy, pricing notes, opening hours, the FAQ page nobody reads. You can upload files, paste text straight in as a source, add product entries, and write curated question-and-answer pairs for questions you already know the exact wording of.

  3. Copy the snippet from the dashboard. Your assistant id is already filled in:

    <script
      src="https://chatfor.site/widget.js"
      data-bot-id="YOUR_BOT_ID"
      defer
    ></script>
    
  4. Install a header and footer plugin. In the WordPress admin, go to Plugins > Add New Plugin, search for it by name, install and activate.

  5. Paste the snippet into the footer field. In WPCode the screen is Code Snippets > Header & Footer; WordPress.com documents the same path for its own hosted sites (Source: WordPress.com support, 2026). Put the script tag in the Footer box, not Header, and not Body.

  6. Save.

  7. Load your site logged out. Open the public site in a private window so no admin bar or caching layer confuses the picture. The launcher should appear bottom right. Ask it something only your documents would know, such as your exact returns window, and check the answer against the document.

If step 7 gives a vague answer, the fix is in the uploads rather than the code. The dashboard shows which passages each answer was drawn from, so you can see whether it read the wrong document or the right document badly.

The attributes, and what each is for

data-bot-id is the only one you need.

Attribute What it does Default
data-bot-id Which assistant to load. Required. none
data-mode bubble floats a launcher in the corner. inline renders the chat inside an element you place. bubble
data-target Inline only. CSS selector of the container to fill. the script tag's parent
data-position Bubble only. right or left. right
data-auto-open Bubble only. true opens the chat on load. false
data-persist false starts a fresh conversation on every page load. resumes within the session
data-api-origin Overrides the API origin. Rarely needed. the script's own origin

The whole widget renders inside a Shadow DOM. Your theme's CSS cannot reach into it and its styles cannot leak out, which is what stops a chat widget from quietly breaking a page builder layout. There are no dependencies, so it does not care whether your site loads jQuery, and defer keeps it out of the critical rendering path. On the Growth plan and above you can drop the chat into a page rather than the corner:

<div id="chatfor-chat" style="height: 560px"></div>

<script
  src="https://chatfor.site/widget.js"
  data-bot-id="YOUR_BOT_ID"
  data-mode="inline"
  data-target="#chatfor-chat"
  defer
></script>

That block goes in a Custom HTML block on your support page, which is the one case where a per-page block is the right tool.

Does this work on WordPress.com as well as self-hosted WordPress?

Yes, on plans that allow it, and the mechanism is the same. WordPress.com documents adding code to the site header through the same Insert Headers and Footers plugin at Code Snippets > Header & Footer, and states the feature is available on "Personal, Premium, Business, and Commerce plans. For free sites, upgrade your plan to access this feature" (Source: WordPress.com support, 2026). On a free WordPress.com site you cannot add third-party JavaScript at all, which is a platform limit rather than anything to do with the widget.

On self-hosted WordPress there is no such gate. All three routes above are open to you.

WooCommerce changes nothing about the install. It is a WordPress plugin, so the footer snippet covers your shop, product and checkout pages the same as any other. What it does change is what you should upload: shipping zones and costs, returns and refunds, payment methods you accept, and any product detail that customers ask about but that is not on the product page. There is more on assembling that material in the guide to the documents an assistant should read.

What it costs to run

An answer costs about 0.45 of a cent to serve, measured at 1,794 input and 87 output tokens per answer across a real support corpus, priced against Anthropic's Claude Sonnet at $2 per million input tokens and $10 per million output tokens. That is a measured constant in the codebase, and it is conservative: a question matching a curated answer never reaches the model and costs nothing.

Plan Price Answers per month Assistants Documents
Free $0 forever 100 1 25
Starter $29 / month 2,000 2 200
Growth $79 / month 6,000 5 Unlimited
Business $199 / month 20,000 Unlimited Unlimited

The Free plan carries a small chatfor.site badge; paid plans do not. Starter adds email support, Growth adds conversation history and search plus the inline placement, Business adds per-assistant usage reporting and a named contact. Every plan begins as a free account, so no card is needed until you choose one.

Embeddings are generated locally through transformers.js using the bge-small-en-v1.5 model, so indexing a document costs nothing per document, which is why the document allowances are as high as they are. Data is stored in Supabase, hosted in Ireland. There is a ceiling of 30 messages per minute per visitor, enforced in Postgres rather than per server instance, so it holds under load.

What breaks on WordPress, and how do you fix it?

The failures are boringly consistent.

  • No launcher. Caching. WordPress sites almost always sit behind a page cache, and your first check should be to purge it and reload in a private window.
  • No launcher on a block theme after editing theme files. The Theme File Editor for block themes is under Tools, not Appearance, and it is easy to edit a file the front end never loads. Use the plugin route instead.
  • Launcher appears twice. The snippet is in both the plugin and a theme file, usually because the first attempt was never removed.
  • Snippet disappeared after a theme update. You used the Theme File Editor. WordPress warned you it would. Move it to a plugin or a child theme.
  • A minifier or optimisation plugin mangles the tag. Exclude chatfor.site/widget.js from JavaScript concatenation and deferral in your optimisation plugin. The script is already deferred and needs no help.
  • Answers say the documents do not cover it. That is the assistant working as designed and pointing at a hole in your corpus. Upload the document that should have answered.

The same widget runs on other platforms with a different paste target: there is a Shopify version of this install, a Squarespace walkthrough, and a platform-agnostic version for anything else.

Frequently asked questions

Do I need a plugin to add a chatbot to WordPress?

No, but it is the best of three options. WordPress has no core screen for adding a site-wide script, so your choices are a header and footer plugin, a child theme hooked to wp_footer, or the Theme File Editor. Only the first two survive a theme update.

Where exactly do I paste the script tag in WordPress?

Into the footer, so it renders before the closing body tag on every page. In a header and footer plugin that is the Footer field, in a child theme it is an add_action( 'wp_footer', ... ) call, and in a theme file it is immediately before </body> in the template that outputs it.

Will a chatbot slow down my WordPress site?

The script carries defer, so it does not block rendering, and it has no dependencies to pull in. Exclude it from any minification or concatenation plugin so nothing rewrites the tag. The widget's own markup and styles live inside a Shadow DOM and never touch your theme's CSS.

Can the chatbot read my WooCommerce orders?

No. It answers only from documents, pasted text, product entries and question-and-answer pairs you supply, with no connection to WooCommerce order or stock data. It cannot say where a specific parcel is. It can state precisely what your shipping and returns policy says.

What happens if a visitor asks something the documents do not cover?

It says it does not have that to hand rather than inventing an answer. Every conversation is visible in the dashboard along with the passages each answer came from, so gaps show up as refusals you can fix by uploading the missing document.

Sources

Try it on your own documents

Upload what you already have and ask it something. The free plan needs no card, and it will tell you when your documents do not cover a question.

Start free