WordPress Plugin
The official WordPress plugin generates an Open Graph image for every post and page through the HTML to Image API. It is built for people who do not want to write code: install it, connect your account, pick a design and publish.
Best for: WordPress sites that want a share image on every post without designing one by hand, and without adding a page builder or an image editor to the stack.
If you would rather call the API yourself from a theme or a custom plugin, the PHP guide shows the same request from any WordPress hook.
Install
Install “Auto OG Images - Open Graph & Social Image Generator by html2img” from the WordPress plugin directory, or search for html2img on the Add Plugins screen. Activate it, open Settings, then OG Images, and paste an API key from your dashboard.
The plugin validates the key with a call to GET /api/me, which costs nothing, and then shows your plan and remaining credits on the settings screen.
What it does
On publish, the plugin builds a card from the post title, author, excerpt, date and featured image, renders it through POST /api/html and saves the PNG into the media library. The correct og:image and twitter:image tags are output on the post, or handed to Yoast SEO, Rank Math, All in One SEO or SEOPress when one of those is active, so the tags are never written twice.
A social image chosen by hand in your SEO plugin wins by default. The generated image fills the gap on every post that has none, and a setting flips that round if you would rather the generated image always won.
Five designs ship with the plugin, each taking an accent colour, a background colour, an optional logo and toggles for the author and site name. A custom template option accepts your own HTML with placeholders such as {{title}} and {{featured_image}}.
How it spends credits
One render is one credit, the same as any API call. The plugin is deliberately tight with them:
- A post is only rendered when something on the card changed. Saving a post without touching the title, excerpt, author or featured image costs nothing.
- Changing the design re-renders nothing by itself. The Tools screen counts how many images are out of date and tells you what a full regeneration will cost before it starts.
- Previews on the settings screen are drawn by your browser, not the API, so trying designs is free.
- When an account runs out of credits the plugin pauses, keeps every existing image in place and shows one admin notice rather than failing post by post.
Free plan notes
Free accounts get 50 credits, a one-time allowance rather than a monthly one. Renders made on the free plan stay on the CDN for 7 days, but the plugin stores every image in your media library by default, so nothing on your site expires. If you switch on the “serve from CDN” option on a free account, the plugin warns you about the 7 day lifetime. Paid plan renders are kept permanently, and upgrading makes earlier renders permanent too.
The default setting downloads each render into wp-content/uploads and serves it from your own domain. Your share images then keep working whatever happens to the account, which is why it is the recommended option on every plan.
Regenerating in bulk
Tools, then OG Images, regenerates existing posts. It shows how many images were made with an older design, how many credits a run will cost and asks before spending anything. Runs happen in batches, save their progress, can be resumed after an interruption and stop cleanly when credits run out. Single posts can also be regenerated from the row action on the posts list, or in bulk from the list table’s bulk actions.
For developers
The GitHub repository documents the filters and actions:
| Hook | Purpose |
|---|---|
html2img_variables | Change or extend the variables a design receives. |
html2img_should_generate | Final say on whether a post gets an image. |
html2img_render_args | Change the arguments sent to the API. |
html2img_designs | Register your own designs alongside the bundled five. |
html2img_dimensions | Change the output width, height and dpi. |
html2img_inline_image_max_bytes | Cap for inlining images as data URIs. |
html2img_api_key | Supply the key from configuration instead of the database. |
html2img_after_generate | Act on each render once the image is stored. |
The template placeholder reference and the post meta keys live there too.
Requirements
WordPress 6.2 or newer and PHP 7.4 or newer. The plugin makes no front end requests to the API and never exposes your key to the browser.