Detect Snippet Errors is a WordPress ability from WPCode — usable via Easy MCP AI, which connects Claude, ChatGPT, and any AI assistant to your site.
Install Free Plugin →Detect Snippet Errors
Read-onlyCheck whether WPCode's error handler has flagged a specific snippet, and get the failure details.
Requires the WPCode (Insert Headers and Footers) plugin on WordPress 6.9+. All five abilities are read-only. 'list-snippets', 'detect-snippet-errors', and 'search-library' require the 'wpcode_edit_snippets' capability, while 'get-error-logs' and 'get-settings' require WordPress's 'manage_options' capability.
What it does
Given a snippet ID, this ability checks whether WPCode's built-in error handler has recorded a failure for that snippet and returns the details: whether an error exists, the error message, the line number it occurred on, the Unix timestamp it happened at, and the URL of the request that triggered it. If the snippet ID doesn't correspond to an existing snippet, the ability returns a 'snippet_not_found' error. This lets an AI assistant pinpoint exactly why a specific piece of custom code is breaking a page, rather than having to dig through the WordPress admin manually.
See it in action
You ask your AI assistant
"Check snippet ID 42 in WPCode and tell me if it's currently causing an error, and on what line."
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| snippet_id | integer | Yes | The ID of the snippet to check for errors. |
Returns
An object with has_error (boolean), error_message, error_line (integer), error_time (Unix timestamp integer), and error_url describing the most recent recorded failure for the snippet.
Permission
The current user must have the 'wpcode_edit_snippets' capability.
More WPCode abilities
Get Error Logs
Pull the full stack trace and file list of recent snippet-related failures site-wide.
Get WPCode Settings
Read WPCode's global settings, including plugin version and Safe Mode status.
List Code Snippets
Get a summary of every WPCode snippet, its status, and whether it's currently erroring.
Search WPCode Library
Search the WPCode Cloud Library of pre-built snippet templates by keyword.