Skip to content
// guide

How to add an AI chatbot to WordPress

Add an AI chatbot trained on your documents to WordPress in about two minutes: paste one snippet with WPCode, or a Custom HTML block for an inline chat.

  • Updated
  • 4 min read
  • add an ai chatbot to wordpress
On this page
  1. What do you need before you start?
  2. Step 1: How do you create the chatbot?
  3. Step 2: How do you copy the WordPress embed code?
  4. Step 3: How do you add the snippet with WPCode?
  5. How do you add an inline chat to one WordPress page?
  6. How does it work with Elementor, Divi and other page builders?
  7. Can you add it without a plugin?
  8. How do you fix common WordPress problems?
  9. How do you move the bubble or open it automatically?
  10. What should the WordPress chatbot know?
  11. What should you set up next?
  12. FAQ

You can add an AI chatbot to WordPress in about two minutes without writing code: create the bot from your documents, then paste one snippet into your site's footer using a code plugin. This guide covers the site-wide chat bubble, an inline chat on a single page, and page builders such as Elementor and Divi.

What do you need before you start?

  • A WordPress site where you can install plugins, or edit your theme files.
  • Your documents (FAQ, policies, product or service information) as PDF, DOCX, TXT, Markdown, CSV, HTML or JSON files, or text you can paste.
  • A free InstantKnowledgeBot account. Sign up with your name and email, then confirm the 6-digit code.

Step 1: How do you create the chatbot?

  1. In the InstantKnowledgeBot dashboard, click New bot.
  2. Pick an industry template or start blank. Templates pre-fill the welcome message, starter questions and instructions; see templates.
  3. Import your WordPress site from its URL (a single page, the whole site or your sitemap), upload documents or paste text. If you only want your FAQ page, import it as a Single page or copy its text in. See create a chatbot from your website FAQ.
  4. Set the name and accent color, and choose hosted Claude or your own AI key.
  5. Test it in the Test tab with real questions.

Step 2: How do you copy the WordPress embed code?

Open your bot's Embed & share tab, choose Chat bubble, and copy the snippet:

<script src="https://instantknowledgebot.com/widget.js" data-bot="YOUR_BOT_ID" defer></script>

The tab also has an Install guides section with WordPress steps and your snippet ready to copy.

Step 3: How do you add the snippet with WPCode?

WPCode (formerly "Insert Headers and Footers") is a widely used free plugin for adding code to every page.

  1. In your WordPress admin, go to Plugins → Add New.
  2. Search for WPCode, then click Install Now and Activate.
  3. Go to Code Snippets → Header & Footer.
  4. Paste the snippet into the Footer box.
  5. Click Save Changes.

Open your site in a new tab and refresh. The chat bubble appears in the bottom corner of every page. If you use a caching plugin (such as WP Rocket, W3 Total Cache or LiteSpeed Cache) or a CDN, clear the cache so visitors get the updated pages.

How do you add an inline chat to one WordPress page?

Sometimes you want the chat inside a page, for example on your Help or Contact page, rather than as a bubble.

  1. In Embed & share, choose Inline iframe and copy the code.
  2. Edit the page in the block editor.
  3. Add a Custom HTML block where the chat should appear.
  4. Paste the iframe code and click Update.

You can use both: the bubble site-wide and the inline chat on your help page. They're the same bot, so analytics stay together. More on inline embeds in iframe and share link embedding.

How does it work with Elementor, Divi and other page builders?

  • Elementor: use an HTML widget for an inline chat on one page. For the site-wide bubble, use Elementor's custom code feature (on plans that include it) or WPCode.
  • Divi: paste the bubble snippet into Divi → Theme Options → Integration → Add code to the < body >, or use a Code module for the inline iframe.
  • Other builders: look for "custom code", "footer scripts" or an HTML element. The snippet is the same everywhere.

Can you add it without a plugin?

Yes, if you're comfortable editing theme files:

  1. Use a child theme, so theme updates don't erase your change.
  2. Go to Appearance → Theme File Editor (or edit via SFTP).
  3. Open footer.php and paste the snippet just before </body>.
  4. Save.

Block themes don't have a classic footer.php, so WPCode or a Custom HTML block is the easier route there.

How do you fix common WordPress problems?

ProblemLikely causeFix
Bubble doesn't appearCached pagesClear your caching plugin and CDN cache.
Bubble doesn't appearScript optimization plugin delays or combines scriptsExclude widget.js from "delay JavaScript" or "combine JS" settings.
Bubble shows on some pages onlySnippet added to a single pageUse WPCode's site-wide Footer box.
Chat is blockedA security plugin sets a strict Content Security PolicyAllow scripts and frames from https://instantknowledgebot.com.

How do you move the bubble or open it automatically?

Set the Widget position (left or right) in the bot's Settings tab, or add data-position="left" to the script tag. Add data-open="true" to open the chat when the page loads, which is useful on a dedicated support page. Changes to the bot's name, greeting, color or knowledge apply instantly, with no need to touch WordPress again.

What should the WordPress chatbot know?

Most WordPress sites already contain the answers: service pages, an FAQ, a contact page and policy pages. Copy their text in, or save them as HTML and upload. Leave out old blog posts and announcements unless they're still accurate; outdated pages are the most common cause of wrong answers.

What should you set up next?

  • Lead capture (Pro and Agency, and during the free 14-day Pro trial) turns visitors who want to book or buy into leads: set up chatbot lead capture.
  • A fallback message with your contact email for questions the bot can't answer.
  • A weekly look at knowledge gaps in the bot's overview for the first month.

The free plan covers one bot and 100 hosted AI messages a month, and messages are unlimited if you connect your own AI key. Compare plans on the pricing page. Not on WordPress? The plain HTML guide works for any site.

Frequently asked questions

Is there an InstantKnowledgeBot WordPress plugin?

You don't need one. The chatbot is a single script tag, so any header-and-footer code plugin (such as WPCode) or your theme's footer settings can add it.

Can I add the chatbot without a plugin?

Yes. Paste the snippet into your theme's footer.php just before </body>, ideally in a child theme so updates don't overwrite it. A code plugin is safer for most people.

Does it work with Elementor, Divi or block themes?

Yes. Use the builder's custom code or HTML widget, or a site-wide code plugin. Block themes work with WPCode or a Custom HTML block.

Will the chatbot work on WooCommerce stores?

Yes. WooCommerce runs on WordPress, so the same snippet adds the chat bubble to product, cart and checkout pages.

Can I use WordPress.com?

Custom code and plugins depend on your WordPress.com plan. On plans that allow plugins, the same steps work; otherwise share the bot's link.

Turn your docs into an AI chatbot today.

Free plan forever, no card needed. Upload your files and get a bot that answers from them in under a minute.

Last updated: · InstantKnowledgeBot