Tutorial · WordPress

How to Set Up a Chatbot on WordPress (Step-by-Step, 2026)

By BotDesk  ·  June 18, 2026  ·  6 min read

Adding an AI chatbot to WordPress takes less than 10 minutes — no plugin required, no developer needed. This guide walks through the exact steps, including two different ways to add the code depending on your setup (with or without a header plugin).

What You'll Need

No plugin required. BotDesk installs with a single JavaScript snippet — one line of code pasted into your site's header. You don't need to install a WordPress plugin. The chatbot loads on every page automatically.

Step-by-Step Instructions

Step 1

Create your BotDesk account

Go to botdesk.studio and start a free trial. During signup, you'll paste your WordPress site URL. BotDesk reads your site and automatically learns your business name, services, hours, and FAQs — so the chatbot knows your business before you configure anything manually.

The auto-training takes about 60 seconds. You can review what it learned and add or correct any details in your dashboard.

Step 2

Copy your embed code

In your BotDesk dashboard, go to InstallWordPress. You'll see a one-line script tag that looks like this:

<script src="https://botdesk.studio/widget.js" data-key="YOUR_API_KEY"></script>

Copy this entire line. Your API key is unique to your account — don't share it publicly.

Step 3

Add the code to your WordPress site

There are two ways to do this. Pick the one that matches your setup:

Method A: Using a Header Plugin

If you have Insert Headers and Footers, WPCode, or any similar plugin, paste the script into the "Header" section. Save. Done.

Method B: Theme header.php

Go to Appearance → Theme Editor → header.php. Find the closing </head> tag and paste the script just before it. Click Update File.

Recommended: Method A with a header plugin is safer — it survives theme updates without re-adding the code. If you're on a block theme that doesn't have a theme editor, the plugin method is your only option.

Step 4

Verify the chatbot appears

Open your WordPress site in a new browser tab (or an incognito window to avoid cache issues). You should see the BotDesk chat widget in the bottom-right corner of the page. Click it to make sure it opens and responds.

If it doesn't appear, try clearing your browser cache or check that the script was pasted in the correct location (inside <head>, before </head>).

Step 5

Customize and test

Back in your BotDesk dashboard, you can:

Send a few test messages to confirm it responds correctly. Pay particular attention to service area questions and pricing — those are the two areas most worth double-checking.

Troubleshooting Common Issues

Widget doesn't appear

The most common cause is a caching plugin. If you're using WP Super Cache, W3 Total Cache, WP Rocket, or similar, clear your cache after installing the script. Also check that the script is inside the <head> tag — scripts placed after </body> won't load correctly.

Widget appears but doesn't respond

This usually means the API key in the script tag is incorrect or was copied partially. Go back to your BotDesk dashboard and copy the full script tag again, then replace the one on your site.

Widget appears on some pages but not others

If you used the Theme Editor method and the widget doesn't appear on specific page templates (like WooCommerce pages, custom post types, or landing pages with separate templates), those templates may have their own header.php. You'll need to add the script to each template file — or use the plugin method, which injects the script globally without needing separate file edits.

Site uses a page builder (Elementor, Divi, etc.)

BotDesk works with all page builders. If your page builder has its own header section (many do), paste the script there. Otherwise, use the theme editor or a header plugin as described above — the script loads independently of page builder output.

💡 Pro tip for WooCommerce stores: If you're running an e-commerce site, make sure the widget appears on your product pages and cart — not just the homepage. Those are high-intent pages where chatbot engagement is most valuable. The global header injection method handles this automatically.

Script Tag vs. Plugin: Which Should You Use?

Both methods above use a one-line script tag, and for most WordPress sites that's the simplest, fastest, and most reliable way to install BotDesk. BotDesk also offers an official WordPress plugin if you'd rather manage everything from the Plugins screen — if you're weighing your options, see our guide to the best AI chatbot plugins for WordPress. That said, the script tag has real advantages:

This is the same approach used by Google Analytics, Intercom, and most major web tools. It's the fastest, most reliable installation method for any platform — not just WordPress.

Ready to add your WordPress chatbot?

Start a 7-day free trial. BotDesk trains on your site automatically and installs in one step. No card required during trial.

Start Free Trial →