WordPress powers over 40% of the web, which means there is a good chance your site runs on it. Adding a chatbot to WordPress is straightforward. You do not need a developer, a custom plugin, or any coding experience. This guide walks through three methods, from the simplest plugin approach to a theme-level install, and covers the gotchas that trip people up.
Before you start
You need two things in place before adding the chatbot to your WordPress site.
1. An Agentkit account with a trained chatbot.
If you have not done this yet, sign up for free and create your first chatbot. Train it on your website content, FAQ pages, documentation, or any other material your visitors ask about. See the training guide for details.
2. Copy the generated embed code.
Open your chatbot in Agentkit, choose Channels > Website embed, select Chat widget, and click Copy code. Paste the complete code into WordPress without changing its script URL or chatbot ID. The current Channels page supplies two script tags, including a small loader before the widget tag.
Enable the Chat widget channel before testing on the public site.
Method comparison
| Method | Difficulty | Plugin required | Applies to | Survives theme updates | Best for |
|---|---|---|---|---|---|
| Plugin (WPCode) | Easiest | Yes (free) | All pages | Yes | Non-technical users |
| Custom HTML block | Easy | No | Specific pages | Yes | Per-page chatbot |
| Theme footer (footer.php) | Moderate | No | All pages | No (child theme needed) | Developers |
Choose the method that matches your comfort level. The plugin approach is recommended for most users because it is the simplest and most resilient to theme updates.
Method 1: Plugin approach (recommended)
This is the easiest method. You install a free plugin that lets you add code snippets to your site without editing theme files.
Using WPCode (Insert Headers and Footers)
WPCode is a free WordPress plugin with over 2 million installs. It lets you add code to your site's header or footer without touching theme files.
Step 1: Install the plugin
- In your WordPress admin, go to Plugins then Add New.
- Search for "WPCode".
- Click Install Now, then Activate.
Step 2: Add the chatbot snippet
- In the WordPress admin sidebar, go to Code Snippets then Header & Footer.
- Find the Footer section.
- Paste both script tags from Channels > Website embed into the Footer box.
- Click Save Changes.
That is it. The chatbot widget will now appear on every page of your WordPress site.
Step 3: Verify it works
- Open your website in a new browser tab (not the WordPress admin).
- You should see the chat bubble in the bottom-right corner.
- Click it and send a test message to confirm it responds correctly.
WPCode was previously called Insert Headers and Footers by WPBeginner. It is the same plugin, not a second installation method. WPCode’s Footer instructions show where the supplied tags go.
Controlling which pages show the chatbot
For a few pages, use the Custom HTML block below if your account can publish scripts. WPCode also has conditional snippet rules, but some page and post rules require a paid license. Check the rule available in your version before relying on it.
Method 2: Custom HTML block (specific pages)
If you want the chatbot on only one or two pages and do not want to install a plugin, you can use the WordPress block editor.
Step 1: Edit the page where you want the chatbot.
Step 2: Add a Custom HTML block at the bottom of the page content.
Step 3: Paste both generated script tags into the block.
Step 4: Update or publish the page.
After publishing, check the rendered page source for both script tags. WordPress can strip scripts from accounts without unfiltered_html, including some Multisite roles. If either tag is missing, use a permitted footer plugin or ask a site administrator. WordPress documents this restriction. WordPress.com sites need a plan that allows plugins and custom JavaScript.
Limitations of this method:
- If you want the chatbot on many pages, this becomes tedious. Use the plugin method instead.
Method 3: Theme footer (footer.php)
This method adds the chatbot at the theme level. It is the most direct approach, but it requires editing theme files.
Important: If you edit your theme's footer.php directly, your changes will be lost when the theme updates. Use a child theme to make this permanent.
With a child theme
Step 1: If you do not already have a child theme, create one. Most theme developers provide instructions. Alternatively, use the "Child Theme Configurator" plugin.
Step 2: In your WordPress admin, go to Appearance then Theme File Editor.
Step 3: Select your child theme from the dropdown.
Step 4: Open footer.php. If it does not exist in your child theme, create it by copying the parent theme's footer.php.
Step 5: Find </body> and paste the complete generated code immediately before it.
Step 6: Save the file.
Without a child theme (not recommended)
If you edit the parent theme's footer.php directly, follow the same steps but know that a theme update will overwrite your changes. If you go this route, keep a copy of your modified footer.php so you can re-apply it after updates.
Testing your installation
After adding the chatbot with any method, run through this checklist.
Basic verification
| Check | How to verify | Expected result |
|---|---|---|
| Widget appears | Visit your site in a new tab | Chat bubble visible in bottom-right |
| Widget opens | Click the chat bubble | Chat window opens with greeting |
| Chatbot responds | Type a question and send | AI response based on your training data |
| Mobile display | Open site on phone or use browser dev tools | Widget is accessible and usable |
| Page load speed | Check browser dev tools Network tab | Widget script loads asynchronously, no blocking |
Cache clearing checklist
Caching is the number one reason people add the chatbot script and do not see it on their site. Clear caches in this order:
- WordPress cache plugin (WP Super Cache, W3 Total Cache, WP Rocket, LiteSpeed Cache): Go to the plugin's settings and purge all caches.
- Hosting-level cache (SiteGround, WP Engine, Cloudflare): Check your hosting dashboard for a cache purge option.
- CDN cache (Cloudflare, StackPath, Fastly): If you use a CDN, purge the cache there as well.
- Browser cache: Open your site in an incognito/private window to bypass local browser cache.
If the chatbot still does not appear after clearing all caches, check the browser developer console (F12 on desktop) for JavaScript errors.
Troubleshooting common issues
The chatbot does not appear
Cause: Caching. This is the most common issue. Follow the cache clearing checklist above.
Cause: a blocked script. In the browser console or Network tab, check the actual host in the generated src URL. If a Content Security Policy blocks it, ask the site administrator to allow that host under the site’s policy.
The chatbot appears but does not respond
Cause: Chatbot not trained. Go to your Agentkit dashboard and confirm your chatbot has training data. An untrained chatbot has nothing to draw from.
Cause: Incorrect chatbot ID. Verify the data-chatbot in your embed code matches the ID shown in your Agentkit dashboard.
Cause: Domain restriction. If you set up domain restrictions in your chatbot settings, make sure your WordPress domain is on the allowed list.
The chatbot conflicts with another chat plugin
If you are running another live chat or chatbot plugin (Tidio, Intercom, Drift, Crisp), the two widgets may overlap or interfere with each other.
Solutions:
- Remove the other chat plugin if you are fully switching to Agentkit.
- If you need both, use Agentkit's Custom HTML block method to place it only on pages where the other plugin is not active.
- Adjust the widget position in your Agentkit dashboard settings if both need to coexist.
Slow page load after adding the chatbot
The Agentkit widget loads asynchronously (the async attribute in the script tag), so it should not block your page from rendering. If you notice slowness:
- Confirm the
asyncattribute is present in your script tag. - Run a speed test (Google PageSpeed Insights, GTmetrix) and check if the Agentkit script is flagged.
- Check your performance plugin for delayed scripts and allow the actual widget URL from Channels if needed.
Configuring the chatbot for WordPress
Once the chatbot is live on your WordPress site, consider these configuration steps in your Agentkit dashboard.
Domain restriction
In your chatbot Settings, set the allowed domain to your WordPress site's domain (e.g., yourdomain.com). This prevents anyone from copying your embed code and using your chatbot on a different site.
Training on WordPress content
The best source for training is your actual website content. In Agentkit, add your WordPress site URL as a training source, and the crawler will index your pages automatically.
Focus your training on:
- FAQ or knowledge base pages
- Product or service pages
- Pricing page
- About page
- Support documentation
- Blog posts that answer common questions
Skip training on pages with thin content, login pages, or pages behind authentication.
For complete training guidance, see How to Train a Chatbot on Your Website Content.
Lead capture
Enable the lead capture action to collect visitor emails and names directly in the chat. Captured leads appear in your Agentkit dashboard and can be sent to your CRM via Zapier or webhooks. See the lead capture documentation for setup.
WordPress-specific integration documentation
For the most current setup instructions and any WordPress-specific features, see the WordPress integration documentation.
Method comparison recap
| Consideration | Plugin (WPCode) | Custom HTML block | Theme footer |
|---|---|---|---|
| Technical skill | None | None | Basic PHP |
| Survives theme updates | Yes | Yes | Only with child theme |
| Site-wide coverage | Yes | No (per-page) | Yes |
| Plugin dependency | Yes (free plugin) | No | No |
For most WordPress users, the plugin method is the right choice. It is quick, safe, and gives you the most flexibility without risking your theme files.
Next steps
Once your chatbot is live on WordPress, spend a few minutes in the Agentkit playground testing responses. If the chatbot is not answering well for specific topics, add more training data for those areas. The playground lets you iterate quickly without needing to test on your live site every time.
Then explore connecting your chatbot to your other tools. The integration guide covers Zapier workflows, webhooks, and the REST API for more advanced setups.
No credit card required.



