A local AI fallback in WordPress is not a switch you flip. WordPress 7.0’s Connectors screen lets a site register more than one AI provider, and a local OpenAI-compatible server — Ollama, LM Studio, llama.cpp’s llama-server, or vLLM — can be registered as one of them. That gives you the raw material. What it does not appear to give you, based on the connector documentation retrieved for this guide, is automatic cloud-to-local failover: both plugins described below register a provider and expose a model, and neither documents switching providers when a cloud call errors out.
So the practical setup is two parts. First, register the local endpoint as a connector so WordPress knows the model exists. Second, add a thin fallback layer in your own code that catches the cloud failure and retries against the local provider. This guide covers both, plus the health checks that let you tell the difference between “the model is slow” and “the endpoint is unreachable.”
What a fallback needs before you configure anything
Four things have to be true before any of the steps below will work:
- A local inference server that speaks the OpenAI-compatible API. The Jokiruiz Local Model Connector description states that it uses
/v1/modelsand/v1/chat/completionsrather than each backend’s native API, so one connector serves Ollama, LM Studio, llama.cpp (llama-server), vLLM, or any other server exposing an OpenAI-compatible endpoint, local or tunneled. - WordPress 7.0+ and PHP 7.4+. Those are the stated requirements for MW Local AI Connector, which is built for the WordPress 7.0+ Connectors primitives.
- Network reachability from PHP to the endpoint. A model running on your laptop is not reachable from a web host. This is the most common reason a fallback silently never fires.
- A decision about where the fallback logic lives. Registering a connector makes the local model available. It does not make it automatic.
Step 1 — Confirm the endpoint answers before WordPress sees it
Test the server directly, from the same machine that runs PHP, before you open the plugin screen. A short-timeout request to the model list is enough:
curl -sS --max-time 5 http://127.0.0.1:11434/v1/modelsPort 11434 is Ollama’s default; substitute whatever your server listens on. A successful response is a JSON object containing a model list. If this command hangs, returns HTML, or returns an empty list, fix that first — the connector will faithfully report the same problem, and you will waste time debugging the plugin instead of the server.
This ordering matters because the Jokiruiz connector performs live model discovery and caches the result so the admin never blocks on a slow or offline backend. If the endpoint is down at configuration time, you may be configuring against a stale or empty list.
Step 2 — Register the local provider as a connector
Two plugins cover this ground, and they take different architectural positions.
Option A: connect directly to the local host
Jokiruiz Local Model Connector (published July 21, 2026, last modified July 21, 2026) registers a new AI connector on the WordPress Connectors screen and exposes your local model to the WordPress AI Client. Its stated design choices are relevant to failover work:
- No API key is needed for local-only mode; a Bearer token is required only if the endpoint sits behind a tunnel.
- A short connect timeout detects an offline backend quickly, while a long generation timeout leaves room for slow local generation on consumer hardware — the two timeouts that matter most in a fallback.
- It relaxes WordPress’ SSRF protection only for the exact host and port you configured, which is what makes a private-IP endpoint reachable at all.
- The API key is never re-printed to the browser, and the description stresses that the plugin does not generate surprise traffic.
Option B: route through a proxy you control
MW Local AI Connector (mattwiebe/ai-connector-for-local-ai, created April 2, 2026) registers an mwlai AI provider with the WordPress AI Client and expects a user-controlled OpenAI-compatible proxy endpoint in front of your local inference server. The recommended proxy helper is SLOProxy, a separate npm package. Setup as documented: copy the plugin into wp-content/plugins/mwlai-connector, activate it, open Settings > Connectors or the dedicated Local AI settings page, then enter the proxy endpoint URL, the shared API key when using a tunneled proxy, and the model to expose. The plugin loads model choices from the configured /v1/models endpoint and restricts the provider to the selected model so WordPress auto-discovery consistently uses it.
Two caveats worth stating plainly. MW Local AI Connector is an independent project by Matt Wiebe and is not affiliated with, endorsed by, or sponsored by Actual Computer, Tailscale, Ollama, LM Studio, or any other third-party service it can be configured to talk to. And at the time of the retrieved data the repository showed 1 star, 1 fork, and one open issue — early-stage adoption, which affects how much community troubleshooting exists if you hit an edge case.
Step 3 — Read the health indicator, not the activation notice
An activated plugin is not a working connector. The Jokiruiz plugin exposes connector health at a glance: connected, unreachable, or auth failed, plus the active model and the latency of the last check. That three-way split is the useful part. “Unreachable” points at the network path or a downed tunnel; “auth failed” points at a mismatched or missing Bearer token. Without that distinction, both failures look identical from inside a WordPress request — an exception with no useful context.
Record the last-check latency. It becomes your baseline for judging whether a later fallback call actually completed or merely timed out more slowly.
Step 4 — Add the fallback logic WordPress does not add for you
This is the part the connector documentation does not cover, so treat the following as an illustrative design rather than a tested recipe. The shape is simple: try the cloud provider, catch the failure, try the local provider, log both outcomes.
<?php
/**
* Illustrative fallback wrapper. Not tested code.
* Replace example_ai_client_generate() with the actual
* WordPress AI Client call for your WordPress version.
*/
function example_generate_text( string $prompt, array $args = array() ) {
// Order matters: cloud first, local second.
$provider_ids = array( 'cloud-provider', 'local-provider' );
$last_error = null;
foreach ( $provider_ids as $provider_id ) {
try {
return example_ai_client_generate( $provider_id, $prompt, $args );
} catch ( Throwable $e ) {
$last_error = $e;
error_log( sprintf(
'[ai-fallback] %s failed: %s',
$provider_id,
$e->getMessage()
) );
}
}
return new WP_Error( 'ai_unavailable', 'All AI providers failed.', $last_error );
}Three implementation notes that matter more than the code itself:
- Verify the API surface against your WordPress version. The placeholder function above is deliberately generic because the exact AI Client method names are version-specific. Check the Connectors documentation for the version you run before wiring this in.
- Do not retry non-idempotent work blindly. Text generation is safe to retry. A workflow that already published, emailed, or wrote to a third party is not. Fall back before the side effect, not after.
- Return a
WP_Errorrather than throwing. Callers that expect a string can then degrade gracefully — showing a cached result or skipping the AI step — instead of taking down the whole page render.
Step 5 — Test the failure on purpose
A fallback you have never triggered is a hypothesis. Simulate each failure mode deliberately and watch the log:
- Cloud key revoked. Expect an auth error from the cloud provider, then a successful local generation. This tests the auth path.
- Cloud host blocked or DNS blackholed. Expect a connection timeout. This tests whether your connect timeout is short enough that users do not stare at a spinner.
- Local server stopped. Expect the fallback to fail too, and confirm you get the
WP_Errorpath rather than a fatal error. - Local server running but slow. Expect success after a long wait. Time it on your actual hardware with your actual prompt length.
The last test is the one people skip, and it is the one that decides whether the fallback is usable. A local model that takes 90 seconds to answer a request your cloud provider handled in two is technically a fallback but functionally an outage.
Troubleshooting the failures you will actually see
- Connection refused or a cURL connect error. The endpoint is down, on a different port, or bound to
127.0.0.1while PHP is running elsewhere. Re-run the/v1/modelscheck from the web server itself. - WordPress refuses to call a private address. This is SSRF protection working as designed. The Jokiruiz connector relaxes it only for the exact host and port you configured — so a typo in the port produces a blocked request, not a helpful error.
- 401 from a tunneled endpoint. Local-only mode needs no credential; a tunneled endpoint needs the Bearer token. Confirm which mode you are actually in.
- Empty model list in the settings screen. The server answered but
/v1/modelsreturned nothing usable. Check the server’s model directory and whether the model is actually loaded. - Generation times out but the model list loads fine. The connect timeout and the generation timeout are separate settings for a reason. Raise the generation timeout; do not raise the connect timeout.
What a local fallback does and does not buy you
It buys continuity. When the cloud API is unreachable, rate-limited, or rejecting your key, the site keeps producing output instead of surfacing an error. It also buys privacy for the fallback path: the Jokiruiz connector’s default posture is that prompts never leave your machine or your network.
It does not buy quality parity. A quantized local model running on consumer hardware will not match a frontier cloud model on every task, and the gap depends on the model, the quantization level, the context length, and the hardware. For memory planning, remember that weight size alone is not the requirement — context and KV cache grow with the prompt, and the runtime adds its own overhead on top.
It also does not buy automatic failover. Neither plugin’s retrieved documentation describes provider-level failover, so the retry logic is yours to own and maintain. And both plugins are recent: one published in July 2026, the other a repository created in April 2026 with minimal adoption so far. Budget time for reading source when something behaves unexpectedly.
A useful next step
Decide which problem you are solving. If you need the site to keep working when the cloud is down, start with Step 1 and Step 4 — verify the endpoint, then wrap the call. If you need the fallback output to be good enough to publish without a human reading it first, benchmark your local model on your real prompts before you rely on it, and keep a review checkpoint in the workflow until the results justify removing it.
If you try this on your own stack, the community is interested in the specifics: your WordPress version, your inference server, the model and quantization, the failure you simulated, and what the log actually said. Share the environment and the error text rather than the conclusion — that is what makes a setup reproducible for the next person.
FAQ
Does WordPress automatically switch to a local model when a cloud AI API fails?
Not according to the connector documentation retrieved for this guide. Both plugins register a provider and expose a model to the WordPress AI Client; neither describes provider-level failover. The switch has to be implemented in your own code or workflow layer.
Can I run a local model connector without an API key?
Yes. The Jokiruiz Local Model Connector works without any credential in local-only mode. A Bearer token is only required if your endpoint sits behind a tunnel.
Why does WordPress block my local endpoint even though it is running?
WordPress' SSRF protection rejects requests to private or internal addresses. The Jokiruiz connector relaxes that protection only for the exact host and port you configured, so a mistaken port or hostname still results in a blocked request.
Will a local fallback produce the same quality as the cloud model?
No guarantee. Output depends on the model, quantization level, context length, and hardware. Treat the fallback as continuity insurance and keep a human review checkpoint if the output is published.
What is the difference between the two connector plugins?
Jokiruiz Local Model Connector points directly at a local OpenAI-compatible host and includes live model discovery, split connect/generation timeouts, and health reporting. MW Local AI Connector registers an mwlai provider and expects a user-controlled proxy endpoint in front of the inference server, with SLOProxy recommended as the proxy helper.