DEV Community

Cover image for Why Most WordPress Webhooks Fail in Production
Mateusz
Mateusz

Posted on

Why Most WordPress Webhooks Fail in Production

Webhooks are one of the easiest ways to integrate WordPress with other systems.

Expose an endpoint.
Send a POST request.
Process the payload.

Done.

At least… until the first production failure.

Once webhooks start powering real integrations, a different set of problems appears:

  • APIs fail
  • endpoints time out
  • payloads get lost
  • debugging becomes nearly impossible

Suddenly the biggest challenge is no longer triggering a webhook.

The real challenge becomes delivering it reliably.

This article focuses on the production side of WordPress webhooks — the things that matter once integrations start running in the real world.


The Problem With Most WordPress Webhook Implementations

A typical webhook implementation looks like this:

wp_remote_post($endpoint, [
    'headers' => [
        'Content-Type' => 'application/json'
    ],
    'body' => json_encode($payload)
]);
Enter fullscreen mode Exit fullscreen mode

If the request succeeds — great.

If it fails?

Most systems simply move on.

No retry.
No visibility.
No way to replay the event.

This approach works fine for hobby projects or simple automations.

But once webhooks power payment flows, CRM syncing, or external automations, reliability becomes critical.

Typical webhook delivery: event → send request → hope it succeeds.


When Should You Use Webhooks vs Polling?

Google loves this question.

Short answer:
Use webhooks when events are important and should trigger actions immediately.

Use polling when the external system does not support webhooks or when you need periodic synchronization.


What Actually Breaks in Production

In production environments, webhook delivery fails more often than you might expect.

Some common failure scenarios:

External API downtime

The receiving service may be temporarily unavailable.

Your webhook fires once and disappears forever.

Network timeouts

Slow APIs can easily exceed WordPress HTTP timeouts.

Temporary bugs in the receiving integration

Developers fix integrations after deployment — but by then the webhook payload is already gone.

Rate limits

Some APIs reject bursts of webhook requests.

Without retries, events are permanently lost.


The Pattern Used by Most Reliable Webhook Systems

Systems like Stripe, GitHub, and Shopify treat webhooks very differently.

Instead of fire-and-forget, they follow this pattern:

  1. Store the webhook payload
  2. Attempt delivery
  3. Retry on failure
  4. Allow replay of past events

This simple change dramatically improves reliability.

It also makes debugging integrations far easier.

Reliable webhook systems store events, retry failures, and allow replay.


A Simple Architecture for Reliable WordPress Webhooks

A production-friendly webhook system usually contains three components:

1. Event storage

Before sending the webhook, store the payload.

A custom table works well for this:

CREATE TABLE wp_webhook_events (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    event_type VARCHAR(100),
    payload LONGTEXT,
    status VARCHAR(20),
    attempts INT DEFAULT 0,
    created_at DATETIME
);
Enter fullscreen mode Exit fullscreen mode

Now every webhook event is persisted.

Nothing disappears.


2. Delivery worker

Instead of sending webhooks immediately, you queue them.

WordPress cron can process the queue:

function processWebhookQueue() {

    $events = getPendingWebhookEvents();

    foreach ($events as $event) {
        sendWebhook($event);
    }

}
Enter fullscreen mode Exit fullscreen mode

If delivery fails, increment the attempt counter and retry later.


3. Replay capability

One of the most powerful debugging tools is replaying a webhook.

If an integration breaks, developers can simply resend the stored event.

This is how many large platforms support developers.

A simple replay function might look like:

function replayWebhook($eventId) {

    $event = getWebhookEvent($eventId);

    if (!$event) {
        return;
    }

    sendWebhook($event);

}
Enter fullscreen mode Exit fullscreen mode

Now integrations become much easier to debug.

Replay capability makes debugging integrations dramatically easier.


Why This Matters for WordPress Integrations

WordPress often acts as the integration hub between different services:

  • WooCommerce → CRM
  • Membership plugins → email platforms
  • forms → automation tools
  • content publishing → external APIs

When webhooks silently fail, those integrations break.

And the worst part?

You often don't even know it happened.

Persisting webhook events changes that completely.

Now you can:

  • inspect payloads
  • retry failed deliveries
  • replay events after fixing integrations
  • debug issues faster

Observability: The Missing Piece

Another common problem with webhooks is visibility.

Without logs, developers are essentially blind.

A good webhook system should expose:

  • delivery status
  • number of attempts
  • response codes
  • response body
  • timestamps

Even a simple admin table showing webhook history can save hours of debugging.


WordPress Is Actually a Great Webhook Platform

Despite these challenges, WordPress is surprisingly well suited for webhook-based integrations.

You already have:

  • an HTTP client (wp_remote_post)
  • REST API endpoints
  • cron scheduling
  • database storage
  • plugin architecture

With a few architectural decisions, WordPress can power surprisingly robust automation systems.

Example: Sending a WordPress Webhook

wp_remote_post($endpoint, [
    'headers' => [
        'Content-Type' => 'application/json'
    ],
    'timeout' => 15,
    'body' => wp_json_encode($payload)
]);
Enter fullscreen mode Exit fullscreen mode

Final Thoughts

Creating a webhook endpoint in WordPress is easy.

Building a reliable webhook system requires a bit more thought.

Once integrations become important to your workflow, it's worth considering:

  • storing webhook payloads
  • retrying failed deliveries
  • allowing event replay
  • logging delivery results

These patterns are used by nearly every major platform that relies on webhooks.

Bringing them into WordPress can make integrations far more reliable — and far easier to debug.

How are you handling webhook reliability in your projects?

Do you store payloads, retry failures, or treat them as fire-and-forget?

Top comments (1)

Collapse
 
flowsystems profile image
Mateusz

One thing I forgot to mention — webhook replay capability has saved me multiple times when integrations broke.