# RAG for WordPress

> RAG for WordPress is a setup that searches your posts, pages, products and documentation by meaning and passes the matching passages to a language model as sources. Your search box or chat assistant then answers from your own content rather than keyword matches. Built well, it reduces made-up answers. It does not eliminate them, so sources and a human hand-off still matter.

URL: https://corrplus.net/blog/rag-for-wordpress/
Updated: 2026-10-22
Corrplus Team

## Why isn't WordPress's built-in search enough?

WordPress search matches the words a visitor types against titles and content. Someone typing "how do I send something back" may get nothing if your page is titled "Returns and withdrawal". The words differ even though the meaning is the same.

The problem is not limited to the search box. Visitors ask the same questions again through live chat, the contact form and messaging apps. The answer is usually already on your site. It just cannot be found.

## What exactly is RAG?

RAG, retrieval-augmented generation, became a common term after the 2020 paper by Lewis and colleagues. The idea is simple: instead of asking a language model a question on its own, first find the relevant documents and pass them in with the question.

On WordPress the flow looks like this:

1. **Preparation:** posts, pages, products and FAQs are split into meaningful passages.
2. **Embedding:** each passage is turned into a numeric vector by an embedding model. OpenAI's embeddings guide describes how these vectors measure how related two texts are.
3. **Storage:** vectors go into a vector store such as pgvector, Qdrant or Supabase.
4. **Retrieval:** the visitor's question is embedded too, and the closest passages are found.
5. **Answer:** those passages and the question go to a language model (OpenAI, Anthropic Claude, Google Gemini), which writes the answer from them.

For a short definition, see our [RAG glossary entry](/glossary/rag/).

## How does RAG compare with search and scripted chatbots?

| Aspect | WordPress search | Scripted chatbot | RAG assistant |
|---|---|---|---|
| Finds by | Keyword match | Pre-written script | Similarity of meaning |
| New content | Visible immediately | Script updated by hand | Visible after re-indexing |
| Answer format | List of links | Fixed text | Explanation compiled from content |
| Risk of wrong answers | Low (it gives none) | Low, but narrow coverage | Present; reduced by sources and hand-off |
| Build and run effort | None | Medium | Index, model and monitoring needed |

RAG is not always the right call. On a fifty-page corporate site a clear menu and a good FAQ page are often enough. RAG pays off on sites with growing documentation, a large product catalogue or a deep archive, and a steady stream of repeat questions.

## Where does it help on a WordPress site?

- **On-site search:** visitors type their question in their own words and get the relevant pages plus a short summary.
- **Customer support:** shipping, returns, setup and pricing questions are answered from the text that is actually on your site.
- **WooCommerce product discovery:** "an unscented cream for dry skin" is matched against product descriptions, not just tags.
- **Internal knowledge:** procedures, policies and proposal templates sit in a private index that only authorised users can query.

## Which build decisions decide the outcome?

**What gets indexed?** Drafts, password-protected pages, member content and form entries should be excluded by default. Choose the content types explicitly.

**How is content split?** Very small passages lose context. Very large ones carry irrelevant text. Splitting along headings tends to work well for WordPress content. Anthropic's write-up on Contextual Retrieval shows that prepending a short note about the source document to each passage improves retrieval accuracy.

**How does the index stay current?** A WordPress hook that fires when a post is saved (`save_post`) or a scheduled job re-processes changed content. An assistant quoting last year's price does more harm than one that says nothing.

**How are answers checked?** Every answer should link its sources. When the retrieved passages do not contain the answer, the assistant should say so and route the visitor to your form or support channel.

**Where is data processed?** If visitor questions go to a model provider in another country, that is a data transfer. Assume questions may contain personal data. Review the provider choice and your privacy notice under GDPR, and under Türkiye's data protection law (KVKK) if you serve Turkish users, with your legal counsel.

## How do you measure whether it works?

Rather than trusting someone else's percentage, compare your own before and after:

- Number of repeat questions reaching support channels
- Share of questions the assistant hands off as unknown
- Clicks on the source links under answers
- Answers that users rate negatively

The last two also expose gaps in your content. The topic the assistant keeps failing on is usually a topic your site never covered.

## What drives the cost?

You can understand where cost comes from without a price list. A WordPress RAG setup has four cost lines.

First, embeddings. Passages are re-embedded whenever content is added or changed. The cost scales with content volume and is small on most sites. Second, language model calls. Every question is a model call, so this line grows fastest with traffic. Starting with a smaller model and escalating only hard questions to a larger one keeps it in check. Third, hosting the vector store. Running pgvector on an existing PostgreSQL database is usually cheaper than a separate service. Fourth, abuse. A public chat box attracts bots. A per-session question limit, a cache for frequent questions and a challenge such as Cloudflare Turnstile stop the bill from growing unexpectedly.

Estimating these lines against your own traffic during design removes the surprises.

## How we approach it at Corrplus

We built this architecture for ourselves first. Our own product, Promptor, brings an AI assistant that knows the site's content into WordPress and works with WooCommerce. In client work we put the indexing scope, chunking and refresh method, model provider and data protection review in writing during design, then deliver a first version tested against real questions. See our [RAG enterprise knowledge assistant](/services/rag-enterprise-knowledge-assistant/) and [WordPress and web platform development](/services/wordpress-web-development/) services.

## Frequently asked questions

### Do I need to rebuild my site to add RAG?

No. Content stays in WordPress. A plugin or a small service reads posts and pages through the REST API or the database, splits them into passages and writes them to a vector database. Your theme and publishing workflow do not change.

### Can a RAG assistant still give wrong answers?

Yes. RAG ties the model to your content, but if the wrong passage is retrieved or the content is out of date, the answer will be wrong too. Show source links with every answer and hand unknown questions to a person.

### Does customer data end up in the vector database?

It should not. Index only public or explicitly selected content, and keep orders, memberships and form entries out. If personal data is involved, assess it under GDPR, and KVKK for Turkish users, with your legal counsel.

### How is RAG different from fine-tuning?

Fine-tuning changes the model itself and has to be repeated when content changes. RAG leaves the model alone and looks up current content on every question. For a WordPress site that is updated often, RAG is usually the more practical and cheaper choice.

## Sources

- [Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (arXiv, 2020)](https://arxiv.org/abs/2005.11401)
- [Anthropic, Contextual Retrieval](https://www.anthropic.com/research/contextual-retrieval)
- [OpenAI, Embeddings guide](https://developers.openai.com/api/docs/guides/embeddings)
- [pgvector: vector similarity search for PostgreSQL](https://github.com/pgvector/pgvector)
- [WordPress REST API: Posts endpoint](https://developer.wordpress.org/rest-api/reference/posts/)
