Code Engine – PHP Snippets, AI Functions & Automation for WordPress
Code Engine is a snippets manager that doesn’t stop at snippets. Yes, it runs your PHP and JavaScript exactly where and when you want: frontend, backend, on a schedule, or inside your content. But its real magic is what happens after you write a function: the same little piece of code instantly becomes a tool your AI chatbots can call, a step you can drag into a visual workflow, and an endpoint the outside world can trigger. One function, three superpowers. Most “code snippets” plugins stop at a textarea and a toggle. Code Engine treats your functions as first-class building blocks for the whole Meow Apps ecosystem, and for anything that can speak REST. Think out of the box, let your creativity flow, because the possibilities really are endless! ✨ For more, check the official website and come say hi on the Discord. Quick Intro Hello! ☀️ I built Code Engine because I was tired of pasting mystery snippets into functions.php and praying. I wanted a place where small bits of code are organized, safe, AI-assisted, and reusable everywhere. Here’s the idea. You write a function (or let the AI write it for you from a plain-English description). That function immediately shows up in three places: AI Engine: your chatbots and MCP clients (Claude, ChatGPT, Claude Code) can call it as a tool, with real arguments. Ask “how many orders shipped today?” and your chatbot runs your function to answer. Workflow Engine: your function appears in the step picker as its very own block. Drag it onto the canvas, wire it between an AI step and a Slack step, done. No glue code. REST / External tools: give it a secure endpoint and a token, then trigger it from Make.com, n8n, Zapier, a cron job, or a webhook. You never wrote an “integration.” You just wrote a function. Code Engine did the rest. 🤝 Core Modules 🧩 Snippets Manager Backend, Frontend, Persistent, Scheduled, Functions, and in-content (PHP/JS) snippets, all in one clean dashboard with tags, search, scope filters, and priorities. 🪄 AI-Assisted Coding Describe what you want in plain English and let AI Engine write the snippet: code, name, arguments, and scope included. Refine existing code or implement it straight from your comments. 🤖 Functions as AI Tools Every Function snippet becomes a function-calling tool and an MCP tool, so your AI Engine chatbots (and external AI agents) can actually do things on your site, not just talk. 🔀 Functions as Workflow Steps Workflow Engine surfaces each of your functions as its own draggable step. Your custom logic becomes a first-class citizen on the automation canvas. 🌐 External Access (REST) Expose any runnable snippet through a secured REST endpoint with a bearer token. Perfect for Make.com, n8n, webhooks, and scheduled external jobs. 🛡️ Safe Mode A snippet that throws a fatal error is automatically caught and disabled before it can take your site down. Code with confidence. ⏰ Scheduling Run a snippet daily at a chosen time via WP-Cron (reports, cleanups, syncs) without touching the server crontab. 🧱 Code Blocks & Shortcodes (Pro) Drop PHP or JS straight into a post or page with a Gutenberg block or the [code-engine] shortcode, with safety guards. 🧩 Snippets, the way they should be Code Engine organizes your code by scope, so each snippet runs exactly where it belongs: Persistent: runs everywhere (frontend and backend). Your everyday “add this to functions.php” code, but managed. Frontend: runs only on the public site. Backend: runs only in the admin. Function: a named, callable function with typed arguments and defaults. This is the reusable building block (see below). Scheduled: runs on a WP-Cron schedule, at the hour and minute you pick. Content (PHP / JS): runs inside a specific post or page, via a Gutenberg Code Block or the [code-engine] shortcode (Pro). Everything is searchable, taggable, sortable by priority, and importable/exportable. The CodeMirror editor gives you proper syntax highlighting and keyboard shortcuts (Cmd+S to save, Cmd+Enter to run). A nikic/php-parser pass validates your PHP before it ever runs. 🪄 Let AI write it for you Don’t feel like writing the boilerplate? Describe the snippet in plain language and Code Engine, powered by AI Engine, generates the whole thing: the code, a sensible name, a description, the right scope, and, for functions, the argument list with names, types, and defaults. Already have code? Ask the AI to modify it from a prompt, or write a few comments describing what you want and let it fill in the implementation. It’s pair programming, right inside your dashboard. ✨ The big idea: write once, use everywhere This is what makes Code Engine different. A Function snippet is not just code you call from other code. It’s a reusable capability that the rest of your stack can plug into. The moment you save it, the same function is available in three places at once: 1. As an AI tool, for chatbots and AI agents With AI Engine active, your functions are exposed through function calling and over MCP (Model Context Protocol). Your on-site chatbot can run them mid-conversation, and external AI agents (Claude, Claude Code, ChatGPT, OpenClaw) can call them too. Want a chatbot that checks stock, looks up a booking, or kicks off a process? Write the function; the chatbot gains the skill. 2. As a workflow step, for automation With Workflow Engine, every active function shows up in the Add-step picker as its own block, named after your snippet, with one input per argument. Drag it onto the canvas and wire it between other steps: an AI step that summarizes, your function that saves, a Social Engine step that posts. There’s also a generic “Execute snippet (by ID / by name)” step when you want to call one dynamically. You never write integration code; your function is the integration. 3. As a REST endpoint, for the outside world Give a snippet a custom endpoint name and a bearer token, and it’s instantly callable from anywhere: POST /wp-json/code-engine/v1/snippets-endpoint/your-endpoint Pass arguments as JSON in the body, secure it with a token, and trigger it from Make.com, n8n, Zapier, GitHub Actions, or a humble cron job. Automation without a middleware bill. 🛡️ Safe by default Running arbitrary code is powerful, so Code Engine takes safety seriously: Safe Mode catches fatal errors and auto-disables the offending snippet, so a typo never white-screens your site. REST whitelisting means global snippets only run on trusted REST routes by default, so you choose what to open up. Per-snippet tokens secure your external endpoints. Validation with a real PHP parser before code is saved. For developers who want fewer guardrails, there’s a “Bypass REST Security” option and filters (mwcode_rest_authorized, mwcode_rest_whitelist) to tailor exactly what’s allowed. Works beautifully with the Meow Apps family Code Engine is one engine in a connected set, each one useful alone, magical together: AI Engine: chatbots, content generation, and MCP. Turns your functions into AI tools. Workflow Engine: visual automation. Turns your functions into draggable steps. SEO Engine: smart, lightweight AI SEO. Social Engine: schedule and automate social posts. Why Code Engine? Reusable, not throwaway Other snippet plugins give you a place to paste code. Code Engine gives you a place to build capabilities that your AI, your workflows, and your external tools can all use. Native to WordPress Clean, fast, and built the WordPress way. No clunky external dashboards, no bloat. AI-native Write snippets with AI, expose them to AI. The whole loop lives in your wp-admin. Developer friendly REST API, MCP tools, function calling, scheduling, import/export, and plenty of filters to hook into. Cared for Part of the Meow Apps family, with regular updates and a real human behind it. 💕
Top keywords
- code32×2.48%
- engine25×1.94%
- ai22×1.71%
- function18×1.40%
- rest13×1.01%
- snippet13×1.01%
- code engine11×0.85%
- functions11×0.85%
- write10×0.78%
- runs9×0.70%
- snippets9×0.70%
- step9×0.70%
Royal MCP – Secure AI Connector for Claude, ChatGPT & any LLM via MCP
The most complete WordPress MCP server — 170+ tools, OAuth 2.0, and nothing leaves your site. Royal MCP gives Claude, ChatGPT, Google Gemini, Perplexity, DeepSeek, Mistral, and every other MCP-compatible AI structured access to your WordPress site: 85 WordPress core tools plus 99 integration tools that auto-load for WooCommerce, Elementor, Divi, Advanced Custom Fields, Yoast SEO, UpdraftPlus, WPForms, and more. Connect Claude to WordPress Royal MCP connects your WordPress site directly to Claude Code, Claude Desktop, or Claude.ai. Setup takes a minute or less: install the connector, authorize, and start your chat. Edit Elementor with Claude First-time setup walkthrough: royalplugins.com/support/royal-mcp/connecting-to-claude/ Connect ChatGPT to WordPress ChatGPT on the web, desktop, and iOS supports MCP servers natively. Add Royal MCP in ChatGPT’s Plugins panel, authorize once, and ChatGPT can read your posts, publish drafts, update product prices, moderate comments, and audit SEO across your site — all through ordinary conversation. Works with every MCP-compatible AI client Royal MCP is not vendor-locked. Claude/Anthropic, ChatGPT/OpenAI, Gemini/Google, Grok/xAI, Llama/Meta, Mistral, DeepSeek, Qwen/Alibaba, Cohere, and Perplexity all work through MCP-compatible clients like Cursor, Windsurf, Cline, Continue, Zed, JetBrains AI Assistant, OpenCode, Warp, Ollama, and LM Studio, all connecting through the same endpoint. Switch AI vendors without rewriting a single connection. How Royal MCP handles authorization Royal MCP speaks full OAuth 2.0 with PKCE and Dynamic Client Registration (RFC 7591) for Claude Desktop, Claude Code, ChatGPT web, and every modern MCP client. Sessions expire, refresh automatically, and can be revoked globally with one button in wp-admin. Clients that don’t speak OAuth get timing-safe API-key auth, per-IP rate limits (60 requests per minute), and the same activity log for every tool call. Where do my credentials go? Nowhere. Your AI client authenticates straight to your WordPress site, and every API key, OAuth token, session, and audit-log entry stays inside your own database. There’s no hosted server sitting between your chat and your site, and no license check or telemetry reaching out on activation. Ollama and LM Studio are first-class platforms alongside Claude, ChatGPT, and Gemini if you want to keep AI inference local too. Can I undo what the AI does? Yes. Every MCP client (Claude Desktop, ChatGPT, and the rest) asks you to approve or deny each destructive tool call by default, until you flip that setting in your connector. On top of that, Royal MCP captures a reverse-state snapshot before every destructive write and hands back a 72-hour undo token. One mcp_undo_last_operation call reverses the change — whether Claude deleted a post, replaced text on an Elementor page, updated a WooCommerce product, or reordered menu items. New posts and pages start as drafts, so nothing the AI writes appears on your live site until you approve publishing. Every tool call also lands in an activity log you can review from wp-admin. Does Royal MCP work with the WordPress Abilities API? Yes. Royal MCP surfaces every AI-callable operation through one endpoint, from three sources: the 85 native tools Royal MCP ships, the 99 integration tools that auto-load when WooCommerce, Elementor, Divi, ACF, Yoast SEO, UpdraftPlus, WPForms, and other supported plugins activate, and every ability any plugin registers through WordPress 6.9’s Abilities API. Your AI sees them all as MCP tools — one connector, no per-plugin setup, no per-vendor rewrite. See what AI agents do to your site The free Royal AI Firewall companion shows every AI agent hitting your site at the HTTP layer (training crawlers, retrieval bots, AI search engines), not just the ones connected through Royal MCP. Install both for a unified view across MCP tool calls and HTTP-layer bot hits. 85 Core Tools + 99 Integration Tools WordPress Core (85 tools): Posts – create, read, update, delete, search, count (any registered public post type, featured images supported) Pages – full CRUD with parent page support Post Types – discover all registered public post types on the site Post Revisions – list revision history and roll a post back to any prior version Media – browse, upload from URL or base64, update alt text/caption/title/description, set as featured image, delete Comments – create, read, delete; full moderation suite (list pending, approve, mark spam, trash) Users – display names and roles (emails and usernames are not exposed) Categories & Tags & Custom Taxonomies – create, update (rename/re-slug/edit/move), delete, assign, count, discover all registered taxonomies Term Meta – read, update, delete (most useful for term-level SEO meta – titles, descriptions, focus keywords stored against categories and tags) Menus – create menus, list menus, list menu items, create / update / delete / reorder menu items Publish and Promote – publish a draft and insert it into a menu in one call, so agents can complete “publish the post and add it to the main nav” in a single tool call Preview Links – generate a shareable draft-preview URL for a single preview session so reviewers can see unpublished changes without a WP login Post Meta – read, update, delete custom fields (works with ACF, MetaBox, JetEngine, Pods, CPT UI) SEO Meta – read and write Yoast SEO, Rank Math, AIOSEO, or SEObolt title/description/focus keyword/robots/OG fields (auto-detects active SEO plugin) SEO Audit – fetch a post’s actual rendered HTML and report title, meta description, canonical, viewport, Open Graph and Twitter Card tags (catches conflicts that only appear in served output) Widgets – list widget instances (optionally filtered by sidebar), list registered sidebars, and update widget content; writes gated by the theme-appearance admin toggle Find and Replace – literal find/replace inside post/page content with dry-run preview, expected-count safety check, and read-after-write verification Undo – reverse the previous delete or reorder within 72 hours via mcp_undo_last_operation Site Info – site name, description, WordPress version, timezone Site Status – full site health snapshot (WordPress version, PHP version, active theme, active plugins, cron activity) for AI-driven pre-write validation Error Log – read recent PHP error log entries so AI agents can diagnose silent failures without shell access Cron Schedule – list scheduled WP cron events with next-run timestamps and hook names Connection Health – MCP session diagnostic returning route, auth method, session ID, and Royal MCP version details for any authenticated caller Plugins & Themes – list installed plugins and themes with active status Theme Appearance – get active theme, read/write theme mods (gated by admin toggle + allowlist), read/write Custom CSS Search – full-text content search across post types Permalink Structure – read and update permalink settings (gated by admin toggle) Options – read allowlisted core options, read full plugin settings by slug (sensitive keys redacted), and write to allowlisted options when an admin enables it Plugin Integrations (Conditional) Royal MCP automatically detects compatible plugins and adds specialized MCP tools. No configuration needed — if the plugin is active, the tools appear. WooCommerce Integration (29 tools): When WooCommerce is active, AI agents can manage your store end-to-end: Browse and search products by category, status, or type Create and update simple and variable products with prices, SKUs, stock levels Manage variable products — list, get, create, update, delete, and batch-update product variations Manage global attributes (pa_* taxonomies) — list registered attributes, list attribute terms, register new attributes, assign attributes to a product as variation axes Manage coupons — list, search by code, get, create, update, delete (trash or permanent), and bulk-purge trash; supports all standard WC coupon fields (discount type, expiry, usage limits, product/category restrictions, email allowlists) View orders, order details, and update order status Create and update orders and attach order notes — for B2B, wholesale, phone orders, and support-note trails List customers with order count and total spent Get store statistics — revenue, order count, average order value by period Elementor Integration (11 tools): When Elementor (free or Pro) is active, AI agents can clone and customize existing Elementor pages without trying to generate page-builder JSON from scratch: Clone an existing Elementor page with a new title and fresh element IDs (so the duplicate opens in the editor without ID collisions) Bulk-replace text across heading, text-editor, button, image-box, icon-box, icon-list, testimonial, tabs, accordion, toggle, star-rating, call-to-action, and flip-box widgets, including image alt and title on image, image-box, image-carousel, image-gallery, and basic-gallery widgets Swap image URLs across image, image-box, background_image, and gallery widget settings Get a compact outline of any page (section/container hierarchy with element IDs, widget types, text snippets) so Claude can reason over a full page in a few KB instead of the raw JSON Read full settings for a single widget/container/section/column by ID (for precise agent editing without loading the entire page tree) List saved templates from the Elementor template library and import templates from JSON Insert an existing library template onto any page at top, bottom, or after a specific element (the library-to-page bridge that the Elementor editor exposes as a two-click picker) Rebuild post_content from Elementor page data on a single page or across all pages with damaged post_content (repairs WordPress core search visibility and SEO auto-descriptions on pages built via prior clone operations) Every write returns a 72-hour undo token via mcp_undo_last_operation Atomic widgets (Elementor 4.0+ Editor V4 elements) pass through opaque — we never decode atomic schemas because Elementor itself may shift them. Widget-level creation from scratch is intentionally out of scope; the design commitment is to work from an existing-known-good source. Divi Integration (9 tools): When Divi (Divi 4 shortcode format or Divi 5 block format) is active, AI agents get safety-first tools for reading and editing Divi content without corrupting builder state: Detect a page’s Divi format (Divi 4 shortcodes, Divi 5 blocks, mixed, or non-Divi) from postmeta rather than the current theme version — so aged pages read correctly even after the theme was updated Get a compact page outline (section/row/module hierarchy with text snippets) so an agent can reason over a full Divi page in a few KB instead of raw markup Validate a Divi shortcode or block layout string before writing it, catching malformed structure before it corrupts the page List saved layouts from the Divi Library, optionally filtered by category or layout type Read a full Divi Library layout by ID for reuse or template extraction Find-and-replace text inside Divi content with dry-run preview, expected-count safety check, active-editor-session detection, and a warning when literal escape sequences appear in the replacement Clone a Divi 4 or Divi 5 page as a new draft, preserving builder meta and regenerating D5 clientIds so the duplicate opens in the editor without ID collisions (72-hour undo token) Swap an image URL across every image-bearing Divi element on a post, dual-format aware for Divi 4 shortcodes and Divi 5 blocks (72-hour undo token) Apply a Divi Library entry to a target page in merge or replace mode (72-hour undo token) Advanced Custom Fields Integration (4 tools): When ACF (free or Pro) is active, AI agents can read and write ACF fields with the field-type-aware formatting the ACF UI uses — instead of the raw serialized values WordPress meta returns: Read a single ACF field, formatted per its Return Format setting (hydrated post objects, parsed repeater rows, image arrays, etc.) Read every ACF field on a post in one call, with name/label/type/value bundled — the most efficient way for an AI to discover what fields exist and read them all Update an ACF field with type-aware value handling (scalar for text/number, array for repeaters and flex content, post ID for relationships, attachment ID for images) Enumerate ACF field groups on the site, optionally filtered by post type — for AI-driven discovery of available custom fields before reading/writing Redirection Integration (4 tools): When John Godley’s Redirection plugin is active, AI agents can manage 301 / 302 / 307 redirects: List redirects with group + URL-substring filters Create new redirects (source, target, status code, regex, group, title) Update existing redirects (target, status, enabled state) List redirect groups Also auto-detected: Yoast SEO Integration (5 tools) — read/write Yoast meta (raw + resolved), capture JSON-LD schema graph, list indexed internal links, list Premium redirects UpdraftPlus Integration (4 tools) — list backups, read status, trigger async backups with entity filtering, read schedule WPForms Integration (4 tools) — list forms, read form schema, (Pro) list submissions, (Pro) read single submission Royal AI Firewall Integration (6 tools) — review AI bot traffic, dashboard stats, and set allow/block/challenge policies per bot signature GuardPress Integration (7 tools) — review your security score, run vulnerability scans, inspect failed logins and blocked IPs SiteVault Integration (6 tools) — list backups, trigger new ones, check progress, review schedules ForgeCache Integration (3 tools) — purge and inspect your page cache Royal Ledger Integration (4 tools) — review recurring software costs and masked license entries Royal Links Integration (3 tools) — manage branded short links and click stats Supported AI Platforms Claude (Anthropic) – Full MCP support via Claude Desktop, Claude Code, and VS Code OpenAI / ChatGPT – GPT-5.5, GPT-5, GPT-5 Mini, o3 Google Gemini – Gemini 3.5 Flash, 3.1 Flash-Lite Groq – Llama 3.3, Llama 3.1, GPT-OSS Azure OpenAI – Azure-hosted OpenAI deployments AWS Bedrock – Claude, Llama, Titan models Ollama / LM Studio – Local self-hosted models (no external data transmission) Custom MCP Servers – Connect to any MCP-compatible endpoint Compatible Clients & Frameworks Royal MCP works with any MCP-compliant client, IDE, or AI agent framework — no per-tool configuration required. Each entry below describes the specific integration path Royal MCP provides for that target, so customers can answer “will this work with the tool I already use?”: Desktop AI apps – Claude Desktop (native MCP connector via OAuth 2.0), ChatGPT Desktop, Gemini Advanced. AI code IDEs – Claude Code, VS Code (with MCP extension), Cursor, Windsurf, Continue, Cline, Zed, JetBrains AI Assistant. API testing tools – Postman, Bruno, Insomnia (use the API key in the X-Royal-MCP-API-Key header). Custom field plugins – Advanced Custom Fields (ACF) has dedicated acf_* tools that return values formatted per each field’s Return Format setting (the same way the ACF UI shows them). MetaBox, JetEngine, Pods, CPT UI, and Custom Field Suite are supported through the wp_get_post_meta / wp_update_post_meta tools, so AI agents can populate custom fields just like a human editor. Page builders – Elementor and Divi have dedicated tools for safe clone-and-customize workflows (Elementor: clone a page, find/replace text, swap images, get an outline, import templates; Divi: format detection, layout validation, page outline, library read, find/replace with builder-format awareness) – see the Tools list. …