[Feature]: Issue 45 | Content Classification (Contextual Tagging)#313
Conversation
…on buttons are attached to the panel visibility.
… and function calls with pre-loaded objects.
|
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 #313 +/- ##
=============================================
+ Coverage 58.09% 59.75% +1.65%
- Complexity 630 701 +71
=============================================
Files 46 49 +3
Lines 3193 3558 +365
=============================================
+ Hits 1855 2126 +271
- Misses 1338 1432 +94
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:
|
|
@jeffpaul -- Thanks for the feedback! I've resolved 1, 2 & 4 -- see below regarding 3 & 5;
That might be a little challenging with this UI being in the sidebar. We might be better off going with a dedicated modal if we're to support that. Is that something we would want to do as opposed to the sidebar UI?
Clicking the suggestion (outside of the 'X') will automatically create (if new) & assign the post to the term -- but I would have expected the Save button for the post to re-appear, since we changed the post state 🤔 I'll have to see what's going on there.
Personally I feel "Regenerate" makes more sense because the initial button says "Generate", but happy to update it if you prefer. |
dkotter
left a comment
There was a problem hiding this comment.
Handful of suggestions / comments / concerns, happy to talk through any of those as needed.
Would also be great to get some E2E tests here prior to this getting merged.
includes/Abilities/Content_Classification/Content_Classification.php
Outdated
Show resolved
Hide resolved
includes/Abilities/Content_Classification/Content_Classification.php
Outdated
Show resolved
Hide resolved
includes/Abilities/Content_Classification/system-instruction.php
Outdated
Show resolved
Hide resolved
includes/Experiments/Content_Classification/Content_Classification.php
Outdated
Show resolved
Hide resolved
includes/Abilities/Content_Classification/Content_Classification.php
Outdated
Show resolved
Hide resolved
includes/Abilities/Content_Classification/Content_Classification.php
Outdated
Show resolved
Hide resolved
…on.php Use $post_id variable. Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
…on.php Use $post_id variable Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
…rB24890/ai into feature/issue-45-contextual-tagging
…cted. Sanitize the max_suggestions filter to ensure its not abused.
includes/Abilities/Content_Classification/Content_Classification.php
Outdated
Show resolved
Hide resolved
includes/Abilities/Content_Classification/Content_Classification.php
Outdated
Show resolved
Hide resolved
dkotter
left a comment
There was a problem hiding this comment.
Code looks good here to me but in testing, I'm getting the following error:
Bad Request (400) - Invalid schema for response_format 'response_schema': In context=(), 'additionalProperties' is required to be supplied and to be false.
Note I only have OpenAI connected, haven't tested with other Providers
Must be an OpenAI thing -- it's working with Gemini. I'll debug and push up a fix. |
@dkotter I added the |
Ah, okay, I think that's fine, ideally that PR gets merged and released soon. Testing again with OpenAI, I am seeing results now but when selecting a term, it's now setting the original taxonomy as the term parent, so I end up with a
In addition, because tags aren't heirarchical, this throws an error anytime I try and save a generated tag, though I only see this error in the console, never reflected in the UI. Fixing the above bug will fix the saving of suggested tags I believe, but if possible, would be ideal to surface any areas so the user knows what's happening. In my case, I clicked on a tag, it disappeared and nothing else happened. I then opened the console and could see the error there.
|
…taxonomy name being used as parent term.
These issues should be resolved. I've added checks to make sure the taxonomy is hierarchical before we attempt to create a parent, and also added checks to ensure the taxonomy isn't returned as the parent. I've added an error message as well if it fails to create the term, so the user shouldn't be left wondering what happened in that case. |
Hmm I'm not able to reproduce this. When I click "Suggest Categories" and then click the back button it navigates back without a notice. If I add a suggested category and click Save, then refresh or navigate away, I also do not get a notice 🤔 -- Are there any console logs you can share that might shed some light on what's happening? |
Sorry, false alarm. Tested on a new post and works great. Disabled all AI features and tried to edit original post and getting the problem so something specific about that post is broken (assuming something wrong in the WP beta release). But not an issue with this PR. Thanks for all the hard work here! |











What?
Closes #45
This PR introduces Content Classification (Contextual Tagging) to the AI Experiments plugin. It allows for one-click AI-powered suggestions for post tags and categories based on a comprehensive analysis of the post's content (as well as title and excerpt). It helps authors apply a relevant and consistent taxonomy, improving content organization, discoverability, and on-site navigation.
Why?
Properly categorizing and tagging content is fundamental to an effective content strategy. It helps readers find related articles and signals relevance to search engines. However, this process is often inconsistent and subjective. This feature removes the guesswork by providing intelligent, context-aware suggestions, leading to a better-organized and more interconnected website.
How?
ContentClassificationExperiment.editor.PostTaxonomyTypeand inject the Experiment UI (buttons, suggestions)wpai_content_classification_content- Filter content before AI processingwpai_content_classification_suggestions- Filter suggestions after AI processingwpai_content_classification_strategy- Filter the strategy settingwpai_content_classification_max_suggestions- Filter the max suggestions settingUse of AI Tools
Testing Instructions
postpost type and confirm the Suggest Categories and Suggest Tags buttons are available in the term selector panels.Screenshots or screencast
Settings UI:

Suggestion UI (block editor):

New Term Suggestions:

Existing Term Suggestions:

Additional Notes
ai_contextual_tagging_strategyfilter, but an inline UI to do so is possible.categoryandpost_tag)