Skip to main content

Setting up OG images with an AI agent

Dynamic OG Image Generator has an agent interface. An AI agent working on your site, such as Claude, can read your image settings and what each page shares, save the whole set up as one file, and apply a file back. It works through two doors WordPress already has: WP-CLI, and on WordPress 6.9 or later the Abilities API.

The interface is part of the plugin. Nothing on your pages or your screens changes until an agent applies a change.

What an agent can and cannot do​

An agent canAn agent cannot
Read every setting, with its default and what it changesSee or change your licence key or any other key
List your posts and pages by their address, with the image each one sharesChange the log level or the Share settings usage switch
Set the Image source of a post, a content type or a site-wide pageOverwrite a change you made in the admin since its file was saved, unless told to
Save the whole set up as one file and apply a file backEdit a page
Check the screenshot server, your plan's usage and the callbackDelete cached screenshots, unless it runs as an administrator
Take a screenshot of a page when askedTake every screenshot at once without being told yes

Screenshots use quota only when asked​

Applying settings or a file never takes a screenshot. A page set to Auto-screenshot is captured the way it always is: the next time it is viewed, or by a refresh. An agent can also ask for one page's screenshot. Asking for every screenshot at once is refused until the agent says yes (wp doig capture run --all --yes), and the refusal says how many screenshots that would take.

Who may use it​

Every ability and command needs the capability doig_agent. The plugin gives it to administrators, and to the shared plugupp_agent role when your site has one. Deleting cached screenshots needs a second capability that only administrators get, so an agent signed in with that role can never delete them.

The site file​

The file holds every setting, every site-wide page group, and each post or page that sets its own Image source. Pages and posts are named by their address, such as /about/, and images by their file name, so the file works on another copy of the same site. It never holds a key, the log level or the Share settings usage switch.

wp doig site export --file=og-images.json
wp doig site diff --file=og-images.json
wp doig site apply --file=og-images.json --dry-run
wp doig site apply --file=og-images.json

A second apply of the same file reports every item unchanged and writes nothing. A setting, page group or post the file leaves out keeps its value.

Site-wide pages are set for a whole group, as on the Settings screen: the Homepage, one archive, all the pages of one taxonomy, or all author archives. The free plugin sets the Homepage. The archive, taxonomy and author groups come with a paid plan.

The agent sees only what your site has. A setting, per-page setting or page group your site does not have is refused with its name, such as "capture_delay is not a setting on this site." The agent's schema lists everything your site does have.

Changes you make in the admin​

When you save the Settings screen, the Dashboard or the Logs tab, or change a post's Image source in the editor or with a bulk action, the plugin records that you edited it. If you did that after the agent's file was saved, the agent's next apply is refused, so your change is not lost. The agent can save the file again and carry your change over, or apply with --force to replace it.

Which pages say more​