Add AI chat to a WordPress site
AskVault reads your WordPress posts and pages from your sitemap, then you paste one script tag into your site footer to show the chat. The agent answers from what you published and shows the pages each answer came from.
It works with any modern theme and page builder, including Elementor, Divi and Astra, and on WordPress.com sites that allow custom scripts. The Free plan covers it. Free
Before you start
- Admin access to WordPress.
- A public site. AskVault reads published pages only: not drafts, private or password-protected posts, comments, or pages your
robots.txtdisallows. - An AskVault account. Sign up at askvault.co/signup.
Step 1: teach your agent your site
WordPress 5.5 and later publishes a sitemap at /wp-sitemap.xml and lists it in robots.txt. SEO plugins such as Yoast or Rank Math publish their own, often /sitemap_index.xml. AskVault finds either automatically.
- For a new agent, paste your site's address in the setup screen.
- For an existing agent, open Knowledge in the sidebar, under Your agent, and add your site's address as a website.
- Optionally exclude archive listings such as
/tag/and/category/.
- For a new agent, paste your site's address in the onboarding screen.
- For an existing agent, open Knowledge, choose Add Source, pick the web crawler and enter your site's address.
- Optionally add rules to leave out archive listings such as
/tag/and/category/.
Limits per crawl:
- Discovery ranks up to 50,000 sitemap URLs and keeps the most useful 5,000.
- Pages kept: as many as fit in your plan's content storage allowance (5 MB on Free). There is no separate page limit.
See add your website and choose which pages to read.
Step 2: add the chat widget
Copy your script tag from Channels (see add the chat widget to your website). Then use one of these methods.
A code snippets plugin (easiest)
A snippets plugin adds the script site-wide and survives theme updates.
- In WordPress, go to Plugins, Add New, install a code snippets plugin such as Code Snippets or WPCode, and activate it.
- Add a new HTML snippet called "AskVault chat widget" and set it to load in the site footer.
- Paste your script tag and save the snippet as active.
- Open your site in a private window. The chat launcher appears.
Your child theme's footer.php
Use this if you already maintain a child theme. Editing a parent theme directly is risky, because the next theme update erases your change.
- Go to Appearance, Theme File Editor and select your child theme.
- Open footer.php, find the closing
</body>tag and paste the script tag on the line above it. - Click Update File.
Block themes (Twenty Twenty-Two and later) have no footer.php. Use the snippets plugin or Google Tag Manager instead.
Google Tag Manager
If your site already loads Tag Manager, keep the widget there: create a Custom HTML tag, paste your script tag, set the trigger to All Pages and publish the container. Add /cart/ or /checkout/ as trigger exceptions to hide the widget on those pages.
To show the widget only to signed-in users, wrap the tag in a PHP check in a snippet:
<?php if ( is_user_logged_in() ) : ?> <!-- paste your AskVault script tag here --><?php endif; ?>Keep your answers current
There is no on-publish sync. After you publish or edit posts, use Resync on the Knowledge page for changed pages, and add the site again to pick up new posts. Paid plans can also schedule automatic re-checks. See keep your agent up to date.
Pages behind a membership login can be read with a session cookie. See pages behind a login.
WooCommerce stores
If you run WooCommerce, connect the store so the agent can look up orders and recommend products from your catalogue. See connect WooCommerce.
Check it worked
- Open your site in a private window and confirm the launcher appears.
- Ask a question your posts answer. The reply shows its sources.
- Send a test message and find it in your Inbox.
If it doesn't work
Only the homepage was indexed. AskVault could not find a sitemap. Open https://yoursite.com/wp-sitemap.xml (or your SEO plugin's sitemap) to check it loads, and make sure search-engine visibility is not switched off under Settings, Reading, which also disables the sitemap.
Answers include menu or footer text. Re-add the affected pages as exact links with a CSS selector for your theme's content area, for example .entry-content.
The launcher does not appear. Caching plugins such as WP Rocket, W3 Total Cache and LiteSpeed Cache can serve signed-in admins an old page. Clear the cache or check in a private window.
"AskVault is not defined" in the browser console. An old chat plugin or a second copy of the script may be loading. Remove the duplicate.
Common questions
Does this work on WordPress Multisite?
Yes. Each site can load its own agent token, so each site gets its own knowledge.
Will SEO plugins still work?
Yes. The chat panel is drawn by the widget and not added to your page's HTML, so Yoast, Rank Math and AIOSEO keep working as before.
Can I leave specific posts out?
Add an exclude rule for their path, or delete them from the Knowledge page after the crawl.