How to add an AI chatbot to WordPress

To add a chatbot to WordPress, paste one script tag into your site's footer, either with a header-and-footer plugin like WPCode or in your theme. Feedbot has no WordPress plugin to maintain: the same snippet works on WordPress.org, WordPress.com paid plans and WooCommerce stores.

  • Setup: 5 minutes
  • WordPress.com: any paid plan (Personal or higher)
  • Free plan, no card
  • Updated

What you need

  • A Feedbot bot. Create one free from your site URL, then copy your bot id from Dashboard → Bot → Install.
  • Admin access to WordPress.
  • On WordPress.com, a paid plan. As of October 2026, WordPress.com says plugin installation is available on Personal, Premium, Business and Commerce. The pricing page lists Personal at $4/month billed yearly.

This is the snippet you will paste:

<script src="https://w.feedbotai.com/v1/feedbot.js" data-bot-id="YOUR_BOT_ID" async></script>

How to add a chatbot to WordPress.org with WPCode

WPCode (formerly Insert Headers and Footers) is free and keeps the snippet safe from theme updates. This is the method we recommend for most sites.

  1. In wp-admin, go to Plugins → Add New Plugin, search for “WPCode” and click Install Now, then Activate.
  2. Go to Code Snippets → Header & Footer. WPCode’s own docs describe this screen.
  3. Paste the snippet into the Footer box.
  4. Click Save Changes.
  5. Open your site in a private window and send a test message. It appears in the Feedbot inbox.

Any other header-and-footer plugin works the same way. Put the script in the footer so it loads after your content.

Adding it without a plugin

If you don’t want another plugin, add the script in your theme. Use a child theme, or your change disappears the next time the theme updates.

Theme type Where to paste Notes
Classic theme (has footer.php) functions.php of a child theme, using the wp_footer hook (example below) Avoid editing footer.php in the parent theme
Block theme (Twenty Twenty-Four, Twenty Twenty-Five) Appearance → Editor, open the Footer template part, add a Custom HTML block and paste the script Only users with the unfiltered_html capability can save scripts. Admins on single sites have it
Page builder (Elementor, Divi) The builder’s own custom code or footer code setting Check that it outputs on every template

The functions.php version:

add_action('wp_footer', function () {
echo '<script src="https://w.feedbotai.com/v1/feedbot.js" data-bot-id="YOUR_BOT_ID" async></script>';
});

How to add a chatbot on WordPress.com

  1. Make sure the site is on a paid plan (see above).
  2. In the dashboard, open Plugins, search for WPCode and install it.
  3. Follow steps 2 to 5 of the WordPress.org method.

On the free plan, WordPress.com removes <script> tags from posts and blocks, so a Custom HTML block will not work there.

Show the chatbot only on some pages

The WPCode Header & Footer screen loads code on every page. To limit it, wrap the script in a condition in functions.php:

add_action('wp_footer', function () {
if (is_page(['pricing', 'contact']) || is_product()) {
echo '<script src="https://w.feedbotai.com/v1/feedbot.js" data-bot-id="YOUR_BOT_ID" async></script>';
}
});

is_product() comes from WooCommerce; remove it if you don’t run a store. To hide the chat on a page instead, flip the condition with !.

Identify logged-in users

If visitors log in (members, customers, LMS students), you can pass who they are so conversations and leads are tied to the account. The hash must be computed on the server with your identity secret, which PHP makes easy:

add_action('wp_footer', function () {
if (!is_user_logged_in()) return;
$u = wp_get_current_user();
$hash = hash_hmac('sha256', (string) $u->ID, FEEDBOT_IDENTITY_SECRET);
printf(
'<script>window.Feedbot=window.Feedbot||function(){(Feedbot.q=Feedbot.q||[]).push(arguments)};Feedbot("identify",%s);</script>',
wp_json_encode(['userId' => (string) $u->ID, 'email' => $u->user_email, 'name' => $u->display_name, 'hash' => $hash])
);
});

Define FEEDBOT_IDENTITY_SECRET in wp-config.php, never in a template. Details are in Identify users.

WooCommerce notes

The widget works on WooCommerce like any other page. The bot can answer about shipping, returns, sizing and products from pages you import. It does not read your WooCommerce orders out of the box. On Pro you can add an HTTP Action that calls an endpoint you control, for example a small order-status route. See the ecommerce chatbot page for what store bots usually handle.

Troubleshooting

Symptom Cause Fix
No chat button Page cache still serves the old HTML Purge your caching plugin and host cache
Button appears, chat never opens An optimization plugin delays or combines JavaScript Exclude w.feedbotai.com/v1/feedbot.js from “delay JS” and minify settings
Script shows as text on the page Pasted into a paragraph block, not Custom HTML Use WPCode or a Custom HTML block
Works on staging, not live (or the reverse) Allowed domains doesn’t list that domain Add the domain in Bot → Install → Allowed domains
Block disappeared after saving Your role lacks unfiltered_html Ask an administrator, or use WPCode

Train it on your site

On the Free plan the bot learns from text and FAQ you paste in. From Starter you can import your WordPress site by URL or sitemap.xml (Yoast and Rank Math generate one at /sitemap_index.xml). Feedbot respects robots.txt and doesn’t re-crawl on its own, so click Refresh website after you publish changes. See Knowledge base for limits per plan and pricing for plans.

Next steps

  • Connect Telegram or Slack so you can take over chats: Human handoff.
  • Send hot leads to your CRM with CSV export or a webhook: Leads.
  • All install options and data-* settings: Install the widget.

Questions

Can't find an answer? Ask the bot in the corner, or write to us.

Is there a Feedbot WordPress plugin?

No. You add Feedbot with one script tag, pasted through WPCode, another header-and-footer plugin or your theme. That means no plugin updates and no extra database tables on your site.

Can I add a chatbot to a free WordPress.com site?

No. WordPress.com allows plugins only on paid plans (Personal, Premium, Business and Commerce), and the free plan strips custom scripts. Upgrade to a paid plan, then install WPCode and paste the snippet.

Does the chatbot work with WooCommerce?

Yes. The widget loads on every page that outputs your theme footer, including shop, cart and checkout pages. It answers from the pages and policies you import. Looking up a specific order is not built in.

Will a chatbot slow down my WordPress site?

The Feedbot loader is about 6 KB gzipped and loads asynchronously. The chat itself loads only when the visitor hovers or clicks the button, or when the browser is idle.

Can I use it as WordPress live chat with a real person?

Yes. When a visitor asks for a person or the bot can't help, Feedbot notifies you in Telegram, Slack, Discord or email, and you can reply live from Telegram or the inbox.

Can I show the chatbot only on some pages?

Yes. Wrap the script in a PHP condition such as is_page() in your child theme, or create a WPCode snippet with conditional logic instead of using the site-wide Header & Footer box.

Keep exploring

Put one agent on your site today

Start on the free plan. Upgrade when conversations grow.