Add bulk "Generate AI Summary" action to the posts list table#650
Add bulk "Generate AI Summary" action to the posts list table#650prasadkarmalkar wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #650 +/- ##
=============================================
- Coverage 74.57% 74.19% -0.38%
- Complexity 1754 1770 +16
=============================================
Files 85 85
Lines 7548 7593 +45
=============================================
+ Hits 5629 5634 +5
- Misses 1919 1959 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Closes #614
Why?
AI summary generation is only available from within the block editor for a single post at a time. This PR adds a bulk workflow that lets users generate summaries for multiple posts in a single action directly from the list table.
How?
References from the existing Alt Text Generation bulk action pattern:
PHP (three new methods on
Summarizationexperiment):register_bulk_action()— appends"Generate AI Summary"to the bulk actions menu.handle_bulk_action()— validates capabilities (edit_posts+ per-postedit_post), then redirects back toedit.phpwithwpai_bulk_summary=1&wpai_post_ids=1,2,3query args.maybe_enqueue_bulk_assets()— detects the redirect on page reload, sanitizes post IDs, resolves the correct REST base from the current post type (so pages and custom post types work), and enqueues the bulk script with localized data (window.aiSummarizationBulkData).JavaScript (
src/experiments/summarization/bulk.ts, new file):DOMContentLoaded, readswindow.aiSummarizationBulkDataand processes posts sequentially.runAbility('ai/summarization', { context: postId })(the ability fetches post content from the DB itself), fetches raw block content via the REST API, strips any pre-existing summary block, prepends the new one, and saves bothcontentandmeta.ai_generated_summaryin a singleapiFetchPOST.wpai_bulk_summaryandwpai_post_idsfrom the URL viahistory.replaceState.Webpack (
webpack.config.js): Addsexperiments/summarization-bulkentry pointing tobulk.ts.Use of AI Tools
AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): Claude Sonnet 4.6
Used for: Initial code skeleton. Final implementation reviewed and edited by me.
Testing Instructions
Prerequisites: An AI connector must be configured in Settings → Connectors.
ai_generated_summaryis addedScreenshots or screencast
Screen.Recording.2026-06-03.at.10.28.13.AM.mov
Changelog Entry