Conversation
|
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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #359 +/- ##
=============================================
+ Coverage 65.75% 66.70% +0.95%
- Complexity 763 813 +50
=============================================
Files 53 54 +1
Lines 3863 3992 +129
=============================================
+ Hits 2540 2663 +123
- Misses 1323 1329 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…cture in the guidelines
|
Based on the post from @aagam-shah: Guidelines Lands in Gutenberg 22.7. The final name is going to be Guidelines, and the plan is to drop the "content" prefix from the naming – confirmed here. It would be good to align with that direction in this PR and use the final name wherever possible. Overall, this PR looks very solid and nicely tackles integration of general-purpose guidelines into existing functionality 👏🏻 |
|
I will update the naming |
| * | ||
| * @var int | ||
| */ | ||
| private const DEFAULT_MAX_GUIDELINE_LENGTH = 2000; |
There was a problem hiding this comment.
I agree, I think we can bump this up. 5000 characters sounds like a good place to start with
The naming is now updated. |
|
@saarnilauri once we get the 0.7.0 release out, will likely need to resolve merge conflicts here to get this ready for merge in the 0.8.0 release cycle |
dkotter
left a comment
There was a problem hiding this comment.
Overall code looks good here but a few things of note:
- Currently doesn't work for me. Doing some quick debugging, it appears the Content Guidelines post type stores in a draft state so our query doesn't work. Not sure if there's something I need to do to get those published or if this is expected
- We've added a few new Abilities since this was opened and we should look to add guidelines support to those: Content Classification and Meta Descriptions
|
I will look into the new abilities and add the guideline injections. |
|
Heads up, the process of renaming CPT to I also noticed that @iamchughmayank started some work around taxonomies: While the current code works, we need to watch the Gutenberg release process and adjust support as needed. |
What?
Closes #322
Adds Content Guidelines integration to the AI plugin, allowing all AI abilities to respect site-wide editorial standards defined via Gutenberg's
wp_content_guidelinecustom post type (introduced in Gutenberg 22.7+).Why?
When sites define content guidelines (tone, style, image standards, etc.), AI-generated content should follow them. Without this integration, AI abilities operate without awareness of the site's editorial standards, producing output that may not align with the site's voice and style.
How?
New
Content_Guidelinesservice (includes/Services/Content_Guidelines.php):wp_content_guidelineCPTsite,copy,images,additional, plus per-block guidelines<content-guidelines>) for prompt injectionwpai_max_guideline_length)wpai_use_content_guidelinesfilterAbstract ability opt-in pattern (
includes/Abstracts/Abstract_Ability.php):guideline_categories()method — subclasses override to declare which categories they useget_content_guidelines_for_prompt()helper fetches and formats guidelines for the declared categoriesget_system_instruction()auto-appends a guidelines-awareness paragraph when categories are declaredPer-ability wiring — each ability declares relevant categories and injects guidelines into its prompt:
site,copysite,copysite,copysite,imagessite,imagessite,imagessite,copy,additionalReview Notes also gains a new
guidelinesreview type that flags content violating the editorial standards.Helper functions in
includes/helpers.php:get_content_guidelines()— retrieve guidelines (optionally filtered by category)format_content_guidelines_for_prompt()— format guidelines for prompt injectionUse of AI Tools
AI assistance: Yes
Tool(s): Claude Code (Opus 4.6 and Sonnet 4.6)
Used for: Initial planning and code implementation; finalization of implementation and tests were reviewed and edited by me.
Testing Instructions
npm run test:e2e:env:startnpm run test:php— runs unit/integration tests includingContent_Guidelines_TestandAbstract_Ability_Guidelines_Testnpm run test:e2e— runs e2e tests includingcontent-guidelines.spec.jswp_content_guidelineCPT doesn't exist).