Skip to content

Persist Suggested Tags, Categories in Content Classification experiment#769

Merged
dkotter merged 2 commits into
WordPress:developfrom
Intenzi:fix/content-classification-suggestions-persistence
Jun 24, 2026
Merged

Persist Suggested Tags, Categories in Content Classification experiment#769
dkotter merged 2 commits into
WordPress:developfrom
Intenzi:fix/content-classification-suggestions-persistence

Conversation

@Intenzi

@Intenzi Intenzi commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #768

Prevents the newly generated suggestions from the Content Classification experiment of Suggested Categories and Suggested Tags from disappearing when re-visited after being hidden from UI due to switch to a different panel/block.

Why?

It is necessary to ensure we don't have to repeatedly utilise the feature to call AI for re-generating the same suggestions due to having visually closed the panel.

Helps ensure good User Experience.

How?

Syncs the generated suggestions to a module-level cache to outlive the lifecycle of individual panel mounts during wordpress post editing:

  • Added cache object (const suggestionsCache: Record<string, TagSuggestion[]> = {};).
  • Initializes useState from the cache.
  • Keeps the cache in sync via a useEffect hook whenever suggestions change.
  • Added e2e test to verify the same.

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity IDE
Model(s): Gemini 3.5 Flash (Low)
Used for: Identifying the issue, relevant code file and deciding correct resolution, implementation. Implemented the e2e test using it. Final implementation and tests were reviewed and edited by me.

Testing Instructions

  1. Navigate to Settings -> AI and ensure Content Classification is enabled.
  2. Create or edit a WordPress Post.
  3. Write a sufficiently long post (at least 50-150 words depending on configuration) to enable classification.
  4. Open the Tags (or Categories) panel in the Post settings sidebar.
  5. Click Suggest Tags (or Suggest Categories) and wait for the suggestion pills to render in the sidebar.
  6. Now, perform either of the following:
  • Action A: Click on any block (for example: a paragraph block) inside the content editor, which focuses the sidebar on block settings, or click the Block tab in the sidebar header manually.
  • Action B: Click the panel toggle to collapse the taxonomy panel and re-expand it.
  1. Re-open the sidebar or Click the Post tab in the sidebar and observe the tags/categories panel.
  2. The AI suggestions will persist.

Screenshots or screencast

Screen.Recording.2026-06-24.at.4.35.49.PM.mov

Changelog Entry

Fixed - Persistence of AI suggested Tags, Categories in Content Classification experiment.

Open WordPress Playground Preview

@github-actions

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Intenzi <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.41%. Comparing base (77f64fa) to head (ec7fba1).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #769   +/-   ##
==========================================
  Coverage      76.41%   76.41%           
  Complexity      1828     1828           
==========================================
  Files             87       87           
  Lines           7764     7764           
==========================================
  Hits            5933     5933           
  Misses          1831     1831           
Flag Coverage Δ
unit 76.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Intenzi Intenzi changed the title Persist Suggested Tags, Categories in Content Classification plugin Persist Suggested Tags, Categories in Content Classification experiment Jun 24, 2026
@dkotter dkotter added this to the 1.1.0 milestone Jun 24, 2026
@dkotter dkotter merged commit 9bd8097 into WordPress:develop Jun 24, 2026
25 of 26 checks passed
jorgefilipecosta pushed a commit that referenced this pull request Jun 29, 2026
…nt (#769)

Fixed - Persistence of suggested terms when running the Content Classification experiment.

Co-authored-by: Intenzi <[email protected]>
Co-authored-by: dkotter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disappearance of suggested Tags, Categories in Content Classification Experiment

2 participants