Search Posts by ACF Field Value


Searches across posts for a given field key/value match, e.g. find all posts where custom field "status" equals "pending".

Property Value
Ability slug mosmcp/search-fields-by-value
Wire tool name mosmcp__search-fields-by-value
Category Advanced Custom Fields (mosmcp-acf)
Plan Free

 

Required access

Requirement Value
Capability edit_posts
Minimum default role Contributor
Requires Advanced Custom Fields
Annotations readOnly: true · destructive: false · idempotent: true · openWorld: false

 

Input schema

Field Type Required Default Description
field_key string Yes — Field name or key to search on.
value string \| number \| boolean Yes — Value or comparison target to match.
compare string (one of =, !=, >, <, LIKE) = Comparison operator.
post_type string — Restrict search to a given post type.
limit integer (1–200) 50 Max number of results to return.

 

Output schema

Field Type Required
matches array
count integer

 

Example

Sample prompt
Find all posts where the custom field 'status' is set to 'pending'.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 426,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__search-fields-by-value",
    "arguments": {
      "input": {
        "field_key": "status",
        "value": "pending"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 426,
  "result": {
    "isError": false,
    "structuredContent": {
      "matches": [
        {
          "id": 42,
          "title": "Spring Catalog",
          "post_type": "post",
          "status": "draft",
          "permalink": "https://example.com/?p=42",
          "matched_field_value": "pending"
        }
      ],
      "count": 1
    }
  }
}

 

Edge cases / errors

  • Posts the caller cannot edit are silently dropped from matches, so count can be lower than limit even when more posts match.
  • A field_... key is translated to the field name before querying; searches run across all post statuses and, unless post_type is given, all post types.
  • limit is clamped to 1-200 (default 50); an unsupported compare falls back to '='.
  • Matching is a raw post-meta comparison, so arrays stored serialized (checkboxes, relationships) usually need compare: LIKE.

 


<< Previous Next >>
List ACF Field Types in Use Update ACF Field Group Location Rules

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.