Push content from your CMS
EdgeKit reads Arc XP and WordPress itself. Any other CMS writes its content to EdgeKit instead: an integration you run beside it calls the content API whenever an item or an author changes. EdgeKit never reads that CMS. Such a content source is pushed, and what you send becomes your organization’s copy of your content, the same copy an Arc XP or WordPress sync writes.
Content › Content › Items shows it, your MCP servers search it, Personalization builds its catalog from it, and newsletter feeds pick from it.
Each write carries one item’s whole state in EdgeKit’s shape. Mapping your CMS’s fields to that shape is your integration’s job.
Set up
Section titled “Set up”1. Add a pushed content source
Section titled “1. Add a pushed content source”You need the site write permission (the Owner and Admin roles).
- Open Content › Configuration › Sources and select Add source.
- Enter a Source key, such as
news: lowercase letters, digits and hyphens. It names this source in every path below and cannot change once saved. - Pick the Content management system: Glide, Labrador, Contentful or Sanity, or Custom CMS for any other. Every CMS except Arc XP and WordPress is pushed.
- Enter the API base URL: your CMS’s own
httpsorigin. EdgeKit stores it and never calls it. - Leave Sites empty. Each item you push names its EdgeKit sites itself.
- Enter the Default language, a BCP 47 tag such as
en. An item pushed withlanguage: nullgets it. - Optionally, enter the Content types your CMS pushes, separated by commas, such as
post, page. EdgeKit then refuses an item of any other type asunknown_content_type. Left empty, any type is accepted. - Select Save.
The source list shows the source as Pushed. Saving starts nothing: EdgeKit holds no item for the source until you push one. See Connect a content source for the rest of the form.
The source key is the {source} in every path. Add one source for each CMS installation, two of the same kind
included: each source keeps its own items and authors, so item 123 of news and item 123 of blog are two
items.
2. Issue a key with content:write
Section titled “2. Issue a key with content:write”- Open Delivery › Delivery › Sites and select any site.
- In API keys, select Can write content items and authors (content:write) and issue the key. See Issue and revoke API keys.
Content belongs to your whole organization, not to one site, so the key’s site does not limit it: one key writes
items for every site. Whoever holds it can change what your MCP servers serve and what your newsletters send, so keep
it on your server. A key without content:write gets 403 on every route below.
The routes
Section titled “The routes”Every route is on https://<tenant>.edgekit.ai and needs a key holding content:write.
| Method | Path | What it does | Reference |
|---|---|---|---|
PUT |
/v1/content/{source}/items/{sourceId} |
Writes one language of one item | contentPutItem |
POST |
/v1/content/{source}/items |
Writes up to 100 items, with a result each | contentWriteItems |
DELETE |
/v1/content/{source}/items/{sourceId} |
Deletes one language of an item with ?language=, else every language |
contentDeleteItem |
POST |
/v1/content/{source}/items/delete |
Deletes up to 100 items, with a result each | contentDeleteItems |
PUT |
/v1/content/{source}/authors/{id} |
Writes one author’s whole profile | contentPutAuthor |
POST |
/v1/content/{source}/authors |
Writes up to 100 authors, with a result each | contentWriteAuthors |
{source} is the source’s Source key, as Content › Configuration › Sources lists it. {sourceId} is the
item’s id in your CMS and {id} an author’s, each 1 to 256 characters. URL-encode them in a path.
Every route is safe to retry.
POST /v1/content/sync is not part of the content API: it asks EdgeKit to read Arc XP or WordPress again and never reads
a pushed source. See Keep content in sync.
Write an item
Section titled “Write an item”A write is one language of one item, whole. Every field is required: leaving one out makes the request 422, and
null, or [] for a list, clears it. There are no partial updates. To change one field, send the whole item again.
Three nulls mean a default:
language: nullis the source’s Default language.raw: nullstores{}.sourceUpdatedAt: nullturns the stale check off for this write: it always applies.
An item, as item.json:
{ "language": "en", "contentType": "article", "contentSubtype": null, "status": "published", "headline": "The week in retail", "description": "Five numbers that explain the quarter.", "promoImage": { "id": "img-1", "url": "https://images.example.com/retail.jpg", "alt": "A shop window", "caption": null, "credit": null, "width": 1600, "height": 900 }, "authors": [ { "id": "12", "name": "Ada Lovelace", "url": "https://example.com/authors/ada", "imageUrl": null, "bio": null } ], "sections": [ { "id": "retail", "key": "retail", "label": "Retail", "parentId": null, "siteId": null, "primary": true } ], "tags": [{ "id": "t-41", "key": "earnings", "label": "Earnings" }], "body": [ { "_type": "block", "_key": "b1", "style": "normal", "markDefs": [ { "_key": "m1", "_type": "link", "href": "https://example.com/q3" } ], "children": [ { "_type": "span", "_key": "s1", "text": "Sales rose in ", "marks": [] }, { "_type": "span", "_key": "s2", "text": "the third quarter", "marks": ["m1"] } ] }, { "_type": "image", "_key": "i1", "url": "https://images.example.com/chart.png" } ], "raw": null, "firstPublishedAt": "2026-10-01T09:00:00Z", "displayDate": "2026-10-01T09:00:00Z", "scheduledAt": null, "sourceUpdatedAt": "2026-10-02T14:30:00Z", "sites": [ { "siteId": "site_daily_example", "url": "/retail/the-week-in-retail" } ]}curl -X PUT https://<tenant>.edgekit.ai/v1/content/custom/items/post-123 \ -H 'Authorization: Bearer ek_your_key' \ -H 'Content-Type: application/json' \ -d @item.json200 answers {"result": "stored"}, or {"result": "stale"} when the stale check skipped the
write. A refused item answers 422 with the reason as its code, and nothing is written:
{ "error": { "code": "tag_without_id", "message": "Every tag needs an id." } }Item fields
Section titled “Item fields”| Field | Type | What it holds |
|---|---|---|
language |
string or null |
A BCP 47 tag, up to 35 characters, stored in canonical form: en_gb and en-gb are en-GB. null: the source’s Default language. See Languages |
contentType |
string | Your CMS’s type, verbatim, 1 to 128 characters, such as article. Never null. One of the source’s Content types, when it lists any |
contentSubtype |
string or null |
Your CMS’s subtype, verbatim |
status |
draft, scheduled or published |
See Status and scheduling |
headline |
string or null |
The headline |
description |
string or null |
The standfirst or summary |
promoImage |
image or null |
The lead image. See Images |
authors |
list of credits | The bylines, in credit order. See Authors |
sections |
list of sections | The item’s sections |
tags |
list of tags | The item’s tags |
body |
list of blocks | Portable Text. See The body |
raw |
object or null |
Your CMS’s own payload, if you want EdgeKit to keep it. Stored, never read. null: {} |
firstPublishedAt |
timestamp or null |
When the item was first published |
displayDate |
timestamp or null |
The date your users see |
scheduledAt |
timestamp or null |
When your CMS will publish it. Required when status is scheduled |
sourceUpdatedAt |
timestamp or null |
When your CMS last changed it. See The stale check |
sites |
list of sites | Where the item appears. See Sites |
A timestamp is ISO 8601 in UTC and ends in Z, such as 2026-10-01T09:00:00Z. One with an offset, such as
+02:00, makes the request 422.
An image, in promoImage:
| Field | Type | What it holds |
|---|---|---|
id |
string or null |
Your CMS’s id for the image |
url |
string | An absolute https URL. Never null |
alt, caption, credit |
string or null |
Alt text, caption and photo credit |
width, height |
positive integer or null |
The size in pixels |
A credit, in authors:
| Field | Type | What it holds |
|---|---|---|
id |
string or null |
Your CMS’s author id. null: EdgeKit makes an id from the name. See Author ids |
name |
string or null |
The byline |
url |
string or null |
The author’s page |
imageUrl |
string or null |
The author’s photo |
bio |
string or null |
A short bio |
A section, in sections:
| Field | Type | What it holds |
|---|---|---|
id |
string | Your CMS’s section id. null refuses the item as section_without_id |
key |
string or null |
A slug |
label |
string or null |
The section’s name |
parentId |
string or null |
The parent section’s id. null at the top |
siteId |
string or null |
The EdgeKit site the section belongs to. null: every site |
primary |
boolean or null |
Whether it is the item’s primary section on its site. null when you do not know |
A tag, in tags:
| Field | Type | What it holds |
|---|---|---|
id |
string | Your CMS’s tag id. null refuses the item as tag_without_id |
key |
string or null |
A slug |
label |
string | The tag’s name. Never null or empty |
A site, in sites:
| Field | Type | What it holds |
|---|---|---|
siteId |
string | An EdgeKit site id |
url |
string or null |
The item’s URL or path on that site |
Your MCP servers’ rules read the ids as item.source_id, item.sections, item.tags and item.authors, and the
types as item.content_type and item.content_subtype. See
Decide what each user gets.
The body
Section titled “The body”body is Portable Text: a list of blocks. Every block needs a _type, and a _key that no other block in the body
has. EdgeKit checks two types and keeps the rest:
blockis text. It takesstyle, a string such asnormalorh2, which is required;listItem,bulletornumber, andlevel, a positive integer, both optional;markDefs; andchildren.childrenis a list of at least one span,{"_type": "span", "_key", "text", "marks"}, wheremarksis an optional list of strings.markDefsholds links only:{"_key", "_type": "link", "href"}. EdgeKit drops any other field of a text block.imagetakesurl, an absolutehttpsURL, plusid,alt,captionandcredit, which are strings, andwidthandheight, which are numbers. All buturlare optional.- Any other
_typeis a custom block, such as an embedded video or a pull quote. EdgeKit stores it exactly as you sent it.
Only text blocks are searched, and an MCP server’s fetch returns their text. Images and custom blocks are stored
and never searched.
A text block with an inline object among its children, or a mark definition other than link, refuses the item as
invalid_block. Map those before you push: an internal link becomes a link with its href, and an inline object
becomes a span or a block of its own. EdgeKit does not convert HTML or Markdown.
sites lists the EdgeKit sites the item appears on, each once, with its URL or path there. Use the id from
The site id. A site id that is not one of your organization’s sites refuses the item
as unknown_site, in sites or in a section’s siteId. A site listed twice refuses it as duplicate_site. A url
that is neither a path nor an absolute http or https URL refuses it as invalid_site_url.
The sites decide where the item is used:
- A site’s MCP server searches and serves only the items listed on that site.
- A newsletter feed picks an item only on a site where its
urlis set. - An item with
sites: []is stored and used on no site.
Images
Section titled “Images”An image url, in promoImage or in the body, must be an absolute https URL; anything else refuses the item as
invalid_image_url. EdgeKit uses the URL exactly as you send it, in newsletters and in your Personalization catalog.
It never resizes, signs or copies a pushed image, so send a URL to an image at a size that works in an email.
Languages
Section titled “Languages”EdgeKit keeps one content item per item and language. A write changes only the language it names: writing de
never touches en, and no write deletes another language. To remove one, delete it. A language
EdgeKit cannot read as a language tag refuses the item as invalid_language.
Status and scheduling
Section titled “Status and scheduling”status |
What EdgeKit does with the item |
|---|---|
published |
Your MCP servers search and serve it, and it goes to your Personalization catalog if you have one |
scheduled |
Stored, never searched. Needs a scheduledAt, or the item is refused as scheduled_without_scheduled_at |
draft |
Stored, never searched |
Drafts and scheduled items are never embedded, sent to an AI model, served by an MCP server or sent to Personalization.
Writing a published item back to draft or scheduled takes it out of search at once.
EdgeKit does not publish an item at its scheduledAt. A scheduled item goes live when you push it again as
published, so make sure your integration pushes when your CMS’s own schedule publishes the item. Until then it stays
scheduled. Just before a newsletter edition sends, EdgeKit checks each scheduled item its feeds picked against what
you last pushed, and leaves out one that is still not published. See
How a feed slot is filled.
The stale check
Section titled “The stale check”Send your CMS’s last-modified time as sourceUpdatedAt. A write whose sourceUpdatedAt is older than the stored one
is skipped and answers stale, so a late retry never overwrites a newer edit. An equal time applies again, so a
retry of the same write answers stored. When either the write’s or the stored sourceUpdatedAt is null, there is
no check, and the last write wins.
After a write
Section titled “After a write”- The item is stored at once and shows in Content › Content › Items. Nothing needs a deploy.
- A published item is then embedded for search and sent to Personalization in the background, as
<source key>:<sourceId>(see Item ids). EdgeKit works through at most 4 items every 3 seconds, so after a backfill of 10,000 items search catches up in about 2 hours. - Text unchanged since it was last embedded is not embedded again and costs no AI action. See What counts as an AI action.
- Content › Content › Sync shows what EdgeKit stores for a pushed item. It has no Re-sync for a pushed source: push the item again instead.
Write in bulk
Section titled “Write in bulk”POST /v1/content/{source}/items takes {"items": [...]}: up to 100 items, each as PUT takes it plus its
sourceId. EdgeKit writes each item on its own, so one refused item blocks no other. 200 answers one result per
item, in the order you sent them.
type ContentItem = { sourceId: string } & Record<string, unknown>; // every field, as PUT takes it
declare const items: ContentItem[]; // up to 100
const response = await fetch( 'https://<tenant>.edgekit.ai/v1/content/custom/items', { method: 'POST', headers: { Authorization: `Bearer ${process.env.EDGEKIT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ items }), },);
if (!response.ok) throw new Error(`content API answered ${response.status}`);
const { results } = (await response.json()) as { results: { sourceId: string; language: string; result: string; reason?: string; }[];};
for (const { sourceId, language, result, reason } of results) { if (result !== 'stored' && result !== 'stale') { console.warn(`${sourceId} (${language}) was not written: ${reason}`); }}{ "results": [ { "sourceId": "post-123", "language": "en", "result": "stored" }, { "sourceId": "post-124", "language": "en", "result": "rejected", "reason": "tag_without_id" }, { "sourceId": "post-125", "language": "en", "result": "stale" } ]}language is the language as stored, after the default and the canonical form. reason is there only on
rejected. A 422 on a bulk route means the request itself is malformed, such as a field missing from any one item,
and nothing is written.
Results and reasons
Section titled “Results and reasons”result |
What happened |
|---|---|
stored |
The item was written |
stale |
Skipped: its sourceUpdatedAt is older than the stored one. Nothing changed |
deleted |
The item was deleted, or was already. Deletes only |
rejected |
Refused for the reason given. Nothing changed for that item |
| Reason | The item |
|---|---|
invalid_language |
has a language EdgeKit cannot read as a BCP 47 tag. Deletes too |
unknown_content_type |
has a contentType that is not one of the source’s Content types |
scheduled_without_scheduled_at |
is scheduled with no scheduledAt |
unknown_site |
names a site, in sites or in a section’s siteId, that is not one of your organization’s sites |
duplicate_site |
lists one site twice in sites |
invalid_site_url |
has a sites entry whose url is neither a path nor an absolute http or https URL |
section_without_id |
has a section with no id |
tag_without_id |
has a tag with no id |
author_without_id |
has a credit with neither an id nor a name |
invalid_image_url |
has an image, the promo image or one in the body, whose url is not an absolute https URL |
invalid_block |
has a body block without a _type or a unique _key, a text block that is not valid, or an image field of the wrong type |
invalid_value |
holds a value EdgeKit cannot store: a NUL character (\u0000) in any text, or a date before year 1 |
unknown_item |
was never written. Deletes only |
An item is refused for the first problem EdgeKit finds, so a corrected item can still be refused for another one. New results and reasons can be added: treat one you do not know as not written.
Delete an item
Section titled “Delete an item”curl -X DELETE 'https://<tenant>.edgekit.ai/v1/content/custom/items/post-123?language=de' \ -H 'Authorization: Bearer ek_your_key'DELETE with ?language= deletes that language of the item, and without it every language. It answers
{"result": "deleted"}. POST /v1/content/{source}/items/delete takes up to 100, as
{"items": [{"sourceId": "post-123", "language": null}]}, where language: null is every language. It answers one
result per entry, in order, with sourceId, language, result and, on rejected, reason.
A delete marks the item deleted and keeps its content, as a delete in a CMS EdgeKit reads does (see
Deleted items). Your MCP servers stop searching and serving it. Once no
language of the item is published, your Personalization catalog marks it deleted. A later write brings it back.
- A retry is safe. Deleting an item that is already deleted answers
deletedagain. - An item never written is
404onDELETEandunknown_itemin bulk. - The language is read as an item’s is:
?language=en_gbdeletesen-GB, and one EdgeKit cannot read is422invalid_languageonDELETE, orinvalid_languagein bulk.
Authors
Section titled “Authors”An author reaches EdgeKit in one of two ways:
- In an item’s
authors: a credit with anamesets the author’s name and any other field it carries; anullfield keeps the stored value, so an item never blanks an author’s bio or photo. A credit with anidand nonamechanges nothing about an author EdgeKit already holds. - Through the authors route, which sets the whole profile:
nullclears a field. Use it when a profile changes in your CMS, for example to remove a bio.
curl -X PUT https://<tenant>.edgekit.ai/v1/content/custom/authors/12 \ -H 'Authorization: Bearer ek_your_key' \ -H 'Content-Type: application/json' \ -d '{"name": "Ada Lovelace", "url": "https://example.com/authors/ada", "imageUrl": null, "bio": null}'The body is name, url, imageUrl and bio, each required, each a string or null; the path carries the id.
200 answers {"result": "stored"}. POST /v1/content/{source}/authors takes up to 100 as
{"authors": [{"id": "12", "name": …}]} and answers {"results": [{"id": "12", "result": "stored"}]}, in the order
you sent them. An id sent twice in one request: the last one wins.
An author write is never refused: past a malformed request, which is 422, every author is stored. It changes no
item. Authors are never deleted.
Author ids
Section titled “Author ids”EdgeKit keeps each source’s author ids apart, so author 12 of news and author 12 of blog are two
authors. It stores a pushed author’s id as <source key>:<id>, such as news:12. The content API adds and
removes the prefix for you: in requests and responses you only use your own ids.
The stored id shows in two places:
- In your MCP servers’ rules,
item.authorsholdsnews:12, so a rule that matches an author uses that form. See Decide what each user gets. - Content › Content › Authors shows it as the author’s Id.
A credit with no id gets name: followed by a hash of its name, with no prefix. The same name is the same author on
every item, from every source. See Authors.
Limits
Section titled “Limits”- 100 items, deletes or authors per bulk request. More is
413. - 2 MiB for one
PUT, 10 MiB for a bulk request. More is413. sourceIdand an authorid: 1 to 256 characters.language: up to 35.contentType: 1 to 128.
Status codes
Section titled “Status codes”| Status | Code | Message | Cause |
|---|---|---|---|
400 |
bad_request |
Malformed JSON in request body |
The body is not JSON. Nothing was written |
401 |
unauthorized |
Missing API key. |
No key on the request |
401 |
unauthorized |
Invalid or missing API key. |
The key is unknown, revoked or expired |
403 |
forbidden |
This key does not hold content:write. |
The key lacks content:write |
404 |
not_found |
No content source with that key. |
Your organization has no content source whose source key is {source} |
404 |
not_found |
No content item with that id. |
A DELETE of an item never written |
409 |
conflict |
The arcxp source is pulled from its CMS, so the content API cannot write it. |
{source} is an Arc XP or WordPress source, and the message names its source key. EdgeKit reads that CMS itself, and its next read would overwrite your write |
413 |
payload_too_large |
Request body too large. |
Over 2 MiB on a PUT, or over 10 MiB on a bulk request |
413 |
payload_too_large |
At most 100 items per request. |
More than 100 items or deletes. For authors: At most 100 authors per request. |
422 |
unprocessable_entity |
Request validation failed. |
The request is malformed: a field missing or of the wrong type, or a timestamp not in UTC. Nothing was written |
422 |
the reason | What to fix | A PUT of an item EdgeKit refused, or a DELETE with a language it cannot read. See Results and reasons |
500 |
internal_error |
Something went wrong. |
Send the request again |
503 |
service_unavailable |
Not configured. |
Item writes and deletes only. The write is stored, but EdgeKit could not queue it for search and Personalization: that is not set up for your organization. Ask EdgeKit, then send the request again |
Re-push to reconcile
Section titled “Re-push to reconcile”EdgeKit never reads a pushed CMS, so it cannot see a write that never arrived: a request that failed, a hook that did not fire, or an edit made before your integration existed. Such an item stays as you last wrote it until you push it again. A pushed source has no nightly reconciliation.
Re-pushing is the reconciliation. Every write is whole and safe to repeat: an unchanged item is stored again, an
older copy is stale, and unchanged text costs no AI action. Push every item again on a schedule, such as nightly,
100 to a bulk request; a first backfill is the same loop, run once. A re-push cannot see an item your CMS deleted, so
send each delete when it happens.
WordPress example
Section titled “WordPress example”EdgeKit can read WordPress itself, with its own mapping and no code of yours beyond a webhook: see
WordPress. Push from WordPress only when you want to write the mapping yourself. A
wordpress source is read by EdgeKit and answers 409 here, so this example writes to a Custom CMS (custom)
source.
A must-use plugin: one PHP file in wp-content/mu-plugins/, which WordPress loads on every request and which cannot
be turned off from wp-admin. It pushes a post when it is saved, when WordPress publishes it on schedule, and when it is
trashed or deleted, and pushes an author when their profile changes.
Put the key and the site id in wp-config.php, not in the plugin:
define( 'EDGEKIT_API_KEY', 'ek_your_key' );define( 'EDGEKIT_SITE_ID', 'site_daily_example' );<?php/** * Plugin Name: EdgeKit content API * Description: Pushes posts and authors to EdgeKit as they change. */
function edgekit_send( $method, $path, $body = null ) { $response = wp_remote_request( 'https://<tenant>.edgekit.ai/v1/content/custom/' . $path, array( 'method' => $method, 'timeout' => 10, 'headers' => array( 'Authorization' => 'Bearer ' . EDGEKIT_API_KEY, 'Content-Type' => 'application/json', ), 'body' => null === $body ? null : wp_json_encode( $body ), ) );
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { // A 4xx says what to fix. Anything else is safe to send again. error_log( "EdgeKit $method $path: " . ( is_wp_error( $response ) ? $response->get_error_message() : wp_remote_retrieve_body( $response ) ) ); }}
function edgekit_time( $timestamp ) { return $timestamp ? gmdate( 'Y-m-d\TH:i:s\Z', $timestamp ) : null;}
function edgekit_push_post( $post_id, $post ) { if ( 'post' !== $post->post_type || 'auto-draft' === $post->post_status ) { return; }
// Trashed or deleted: delete every language. if ( 'trash' === $post->post_status || doing_action( 'deleted_post' ) ) { edgekit_send( 'DELETE', "items/$post_id" ); return; }
$statuses = array( 'publish' => 'published', 'future' => 'scheduled' ); $status = $statuses[ $post->post_status ] ?? 'draft'; $date = edgekit_time( get_post_timestamp( $post ) ); $author = (int) $post->post_author; $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post ), 'full' );
$sections = array(); foreach ( get_the_category( $post_id ) as $term ) { $sections[] = array( 'id' => (string) $term->term_id, 'key' => $term->slug, 'label' => $term->name, 'parentId' => $term->parent ? (string) $term->parent : null, 'siteId' => null, 'primary' => null, ); }
$tags = array(); $terms = get_the_tags( $post_id ); foreach ( is_array( $terms ) ? $terms : array() as $term ) { $tags[] = array( 'id' => (string) $term->term_id, 'key' => $term->slug, 'label' => $term->name ); }
// One text block per paragraph. Map headings, links and images as your posts need. $body = array(); $text = wp_strip_all_tags( str_replace( '</p>', "</p>\n\n", $post->post_content ) ); foreach ( preg_split( '/\n\s*\n/', $text ) as $i => $paragraph ) { $paragraph = trim( html_entity_decode( $paragraph, ENT_QUOTES, 'UTF-8' ) ); if ( '' !== $paragraph ) { $body[] = array( '_type' => 'block', '_key' => "p$i", 'style' => 'normal', 'markDefs' => array(), 'children' => array( array( '_type' => 'span', '_key' => "p$i.0", 'text' => $paragraph, 'marks' => array() ), ), ); } }
edgekit_send( 'PUT', "items/$post_id", array( 'language' => null, 'contentType' => $post->post_type, 'contentSubtype' => get_post_format( $post ) ?: null, 'status' => $status, 'headline' => $post->post_title ?: null, 'description' => $post->post_excerpt ?: null, 'promoImage' => $image ? array( 'id' => (string) get_post_thumbnail_id( $post ), 'url' => $image[0], 'alt' => null, 'caption' => null, 'credit' => null, 'width' => $image[1] ?: null, 'height' => $image[2] ?: null, ) : null, 'authors' => $author ? array( array( 'id' => (string) $author, 'name' => get_the_author_meta( 'display_name', $author ) ?: null, 'url' => get_author_posts_url( $author ), 'imageUrl' => null, 'bio' => null, ), ) : array(), 'sections' => $sections, 'tags' => $tags, 'body' => $body, 'raw' => null, 'firstPublishedAt' => 'published' === $status ? $date : null, 'displayDate' => $date, 'scheduledAt' => 'scheduled' === $status ? $date : null, 'sourceUpdatedAt' => edgekit_time( get_post_timestamp( $post, 'modified' ) ), 'sites' => array( array( 'siteId' => EDGEKIT_SITE_ID, 'url' => get_permalink( $post ) ), ), ) );}add_action( 'wp_after_insert_post', 'edgekit_push_post', 10, 2 );add_action( 'deleted_post', 'edgekit_push_post', 10, 2 );
function edgekit_push_author( $user_id ) { $user = get_userdata( $user_id );
if ( $user && user_can( $user, 'edit_posts' ) ) { edgekit_send( 'PUT', "authors/$user_id", array( 'name' => $user->display_name ?: null, 'url' => get_author_posts_url( $user_id ), 'imageUrl' => get_avatar_url( $user_id ) ?: null, 'bio' => $user->description ?: null, ) ); }}add_action( 'profile_update', 'edgekit_push_author' );What it does, and what to change for your site:
- It hooks
wp_after_insert_post, notsave_post. The block editor firessave_postbefore it saves a post’s categories and tags, so an item built there carries the old ones.wp_after_insert_postfires after them, on every save, on trash and restore, and when WordPress publishes a scheduled post, which is what takes a scheduled post live in EdgeKit. publishispublished,futureisscheduled, and every other status,privateincluded, isdraft.- The body keeps paragraphs as plain text. Map headings, lists, links and images to Portable Text as your posts need.
- A site served over
httphashttpimage URLs, which EdgeKit refuses asinvalid_image_url. - Failures are logged and not retried, and each save waits up to 10 seconds for EdgeKit. Re-push to catch up, for example with WP-CLI:
wp eval 'foreach ( get_posts( array( "post_status" => "any", "numberposts" => -1 ) ) as $post ) { edgekit_push_post( $post->ID, $post ); }'