Search content
wp_searchSearch posts, pages and other entries by words in title, excerpt and content, across one or all post types, ordered by relevance. Returns result summaries without content.
Instructions
Search posts, pages and other entries for words in title, excerpt and content, across all searchable post types or one, ordered by relevance. Every status but trash, auto-draft and others registered as excluded from search is searched (drafts and private entries included); only entries the account may read are returned. Returns {query, total, results}; results are summaries as in wp_list_posts (no content), up to per_page, without further pages. Needs edit_posts. Read-only. wp_list_posts also takes search, with filters and paging.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Post type, or "any" for every post type not excluded from search. Default any. Revisions are not searched. | any |
| query | Yes | Words to search for. | |
| per_page | No | Maximum number of results, 1–100; other values are clamped. Default 20. |