Skip to content

Find Text in Posts without Opening Them ​

wp_find_in_post searches stored post text without changing it. The connected WordPress user must be allowed to edit the posts being inspected.

In this article

Count or locate matches ​

Ask your AI client to call wp_find_in_post with ids containing 1–20 post IDs and queries containing 1–10 strings, each no longer than 500 bytes. By default, it searches each post's post_content. Set field to post_excerpt or post_title to search a different field.

Matching is case-sensitive by default. Set case_sensitive to false to ignore letter case. By default, max_matches is 0, so the reply contains counts without match locations. Set max_matches from 1 to 20 to request locations and snippets. Counts describe stored text, including markup, not just what visitors see.

Compare stored content ​

Post read and write replies include content_sha256 and content_bytes: the SHA-256 hash and byte length of the stored post_content. When you search post_content, the find result's sha256 and bytes describe the same stored value. Compare these values in later replies to see whether the post content has changed.

These fields describe only post_content, not the title, excerpt, metadata, or a page builder's separate layout. They are not an automatic edit lock.

Check results before editing ​

A null count with an incomplete reason does not mean there were no matches. A truncated reply may omit locations while retaining counts and errors. Check per-post errors and any builder warning before choosing an editing tool. Edit builder-owned content with the layout tools, not by replacing its raw storage.

Was this helpful?