Jigar Patel Post Content Summary With AI
Jigar Patel Post Content Summary With AI
Description
JP Post Content Summary With AI adds a “Generate Summary with AI” button to the post editor. One click sends the article content to your chosen AI provider (Anthropic Claude or OpenAI), which returns a short summary (200 characters max). The summary lands in an editable text field so editors can tweak it before publishing. Once the post is saved, the summary is stored in post_meta and automatically prepended to the post content on the front end, inside a rounded, bordered box.
Features
- One-click AI summary generation from the post editor
- Editable summary field with a live 200-character counter
- Works with Anthropic (Claude) or OpenAI — your choice, your API key
- Summary is stored in
post_meta(key:_ai_short_summary) - Automatically displayed above the post content in a styled box — no theme edits needed
- Server-side enforcement of the 200-character limit, even if the field is edited manually
- Nonce-protected AJAX request and standard WordPress capability checks
How It Works (Step by Step)
-
Configure your API key
Go to Settings JP PostSummary With AI in wp-admin. Choose a provider (Anthropic or OpenAI), paste your API key, and optionally specify a model (defaults:claude-sonnet-4-6for Anthropic,gpt-4o-minifor OpenAI). Save changes. -
Open a post
Edit any post (new or existing). Below the main content editor you’ll see a “Short Summary (AI)” box. -
Generate the summary
Click “Generate Summary With AI.” The plugin sends the post’s title and content (up to ~6000 characters) to the configured AI provider via a secure server-side AJAX request (admin-ajax.php, nonce-verified). The AI returns a short summary, which is inserted into the text field below the button. -
Review and edit
The summary is fully editable. A live character counter (e.g. “142 / 200”) shows how much room is left, and turns red if you exceed the limit. You can also skip AI generation entirely and type your own summary. -
Save/Publish the post
When you click Update or Publish, WordPress’s standardsave_posthook fires. The plugin verifies the nonce and your editing capability, sanitizes the text, truncates it to 200 characters at a clean word boundary if needed, and saves it topost_metaunder the key_ai_short_summary. -
Automatic front-end display
On the single post view, athe_contentfilter checks for a saved summary. If one exists, it’s wrapped in a<div class="jppsai-summary-box">— rounded corners, subtle border and shadow — and prepended before the rest of the article content. No template edits are required; this happens automatically via the filter.
External services
This plugin uses the WordPress AI Client, the AI infrastructure built into WordPress core (7.0+), to generate short article summaries. It does not connect to any external service directly or on its own — it works only through whichever AI provider(s) the site administrator has configured under Settings AI Credentials. Depending on that configuration, the plugin’s “Generate Summary by AI” button will cause the post title and content to be sent to one of the following third-party services:
Anthropic (Claude models)
* What it is / what it’s used for: a generative AI service used to produce the short article summary text.
* What data is sent, and when: the post title and up to approximately 6,000 characters of the post content, sent only when an editor clicks the “Generate Summary by AI” button (never automatically or in the background).
* Terms of Service: https://www.anthropic.com/legal/consumer-terms
* Privacy Policy: https://www.anthropic.com/legal/privacy
OpenAI (GPT models)
* What it is / what it’s used for: a generative AI service used to produce the short article summary text.
* What data is sent, and when: the post title and up to approximately 6,000 characters of the post content, sent only when an editor clicks the “Generate Summary by AI” button (never automatically or in the background).
* Terms of Service: https://openai.com/policies/row-terms-of-use/
* Privacy Policy: https://openai.com/policies/row-privacy-policy/
Data & Privacy Notes
- Post title and content (up to ~6000 characters) are sent to the configured third-party AI provider (Anthropic or OpenAI) when the “Generate Summary With AI” button is clicked.
- No data is sent automatically — generation only happens on explicit button click.
- Refer to your chosen provider’s privacy policy and terms of service for how they handle submitted data.
Known Limitations
- Any user with
edit_postscapability can trigger a billed API call by clicking the button. If you have many editors, consider adding rate-limiting. - Summary generation is synchronous — the request happens while the editor waits, so response time depends on the AI provider’s latency (typically a few seconds).
Installation
- Upload the plugin zip via Plugins Add New Upload Plugin, or extract it into
/wp-content/plugins/jigar-patel-post-content-summary-with-ai/. - Activate the plugin through the Plugins menu.
- Go to Settings JP PostSummary With AI and enter your API key and provider.
- Edit any post and use the “Generate Summary With AI” button in the post editor.
Faq
Anthropic (Claude) and OpenAI out of the box. The API-calling logic is isolated in two functions (jppsai_call_anthropic() and jppsai_call_openai()), so adding another provider just means adding a similar function and a case in jppsai_call_ai_api().
In the wp_postmeta table, under the meta key _ai_short_summary, tied to the post ID.
No. The summary box is injected via the the_content filter and its styles via wp_head, so it works with any theme without editing template files.
It’s automatically truncated at the nearest word boundary and an ellipsis is appended, both when displayed in the editor and again server-side when saved, so the stored value never exceeds the limit.
Yes. The text field is always editable — the AI button is a convenience, not a requirement.
By default it’s enabled for the post post type. Other post types can be added via the jppsai_post_types filter, e.g.:
add_filter( 'jppsai_post_types', function( $types ) {
$types[] = 'news';
return $types;
} );
It’s stored in the wp_options table (via the Settings API) and is never sent to the browser. Make sure your site runs over HTTPS and that only trusted admins have access to Settings JP PostSummary With AI.
Reviews
Changelog
1.0.0
- Initial release: AI summary generation button, editable field with character counter, post_meta storage, automatic front-end display box, settings page for API key/provider.