Skip to content

[Feature]: Issue 240 | SEO Descriptions#318

Draft
TylerB24890 wants to merge 20 commits intoWordPress:developfrom
TylerB24890:feature/issue-240-seo-descriptions
Draft

[Feature]: Issue 240 | SEO Descriptions#318
TylerB24890 wants to merge 20 commits intoWordPress:developfrom
TylerB24890:feature/issue-240-seo-descriptions

Conversation

@TylerB24890
Copy link

@TylerB24890 TylerB24890 commented Mar 18, 2026

What?

Closes #240

This PR introduces a new Experiment "Meta Descriptions" which provides AI generated meta description support.

Why?

Meta descriptions are an important aspect of a pages SEO, yet they are often overlooked or lacking in quality. See #240 for more detail.

How?

This Experiment introduces a new panel to the block editor PluginDocumentSettingPanel for managing the SEO meta description for the current post. The initial view provides a simple button to "Generate Meta Description". On click of the button, a modal window opens which shows the suggested meta descriptions returned from the AI and a TextAreaControl input allowing editors to manipulate the suggested descriptions prior to saving them to the post.

On select of a suggestion, the TextareaControl component is populated with the selected suggestion at which point the editor can update the text as needed.

From there, editors have a few options;

  • Clicking "Apply" will save the content from the TextareaControl component to the appropriate meta key
    • If a supported SEO plugin is installed and active, the plugins meta key will be used. Otherwise a default _meta_description key is stored.
  • Clicking "Copy to Clipboard" will copy the content from the TextareaControl to the users clipboard.
  • Clicking "Cancel" will close the modal without applying any meta description changes.
  • Clicking "Regenerate suggestions" will send the prompt to the AI again for a new set of suggestions.

Various filters are available for customizing the experiment;

  • ai_meta_description_prompt - Attach additional (or modify) context sent to the AI for the meta description
  • ai_meta_description_candidate_count - The number of suggestions returned. Default is 3.
  • ai_meta_description_result_temperature - The temperature threshold for the model. Default is 0.7
  • ai_meta_description_seo_plugin - The supported SEO plugins in ['file' => 'path', 'meta_key' => 'key' ] format.
    • Default supported plugins: YoastSEO, RankMath, All in One SEO, SEOPress
    • This configuration is what determines the meta key the description is saved to.
  • ai_meta_description_meta_key - Override the meta key the description is saved to. This will take priority over any plugin configurations.

Use of AI Tools

  • AI Assistance: Yes
  • Tool(s): Claude Code (Opus 4.6)
  • Used for:
    • Experiment scaffolding
    • Unit test boilerplates
    • Debugging support & code suggestions
    • Inline documentation and experiment documentation generation
    • Assistance with the system prompt generation

Testing Instructions

  1. Visit the Experiments settings page in wp-admin and enable the Meta Descriptions Experiment.
  2. Navigate to a post and confirm the Meta Description panel exists just below the "Move to Trash" button (should be the top panel above Categories)
  3. Click the "Generate meta description" button. The modal window should open with the suggested descriptions available for selection.
  4. Select a meta description and confirm the content is dropped into the Text Area for customization.
  5. Customize the description and click the Apply button. The Meta Description panel in the sidebar should now show the description with an option to Edit or Regenerate.
  6. Save the post and confirm the meta description remains after refresh.
  7. Edit the meta description and confirm the content is saved as expected.
  8. Regenerate the meta description and confirm the content is saved as expected.
  9. Install Yoast SEO plugin
  10. Repeat steps 1-9 and confirm the meta description is saved to the YoastSEO meta key instead of the default _meta_description key.
  11. Repeat step 9-10 for each of the supported plugins.

Screenshots or screencast

Initial State:
meta-description-initial

Generated Descriptions:
meta-description-selection

Selected Description:
meta-description-selected

Saved Description:
meta-description-generated

Open WordPress Playground Preview

@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 76.95473% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.21%. Comparing base (32c5e2d) to head (479c466).

Files with missing lines Patch % Lines
...es/Abilities/Meta_Description/Meta_Description.php 80.82% 28 Missing ⚠️
.../Experiments/Meta_Description/Meta_Description.php 57.62% 25 Missing ⚠️
...des/Abilities/Meta_Description/SEO_Integration.php 94.44% 2 Missing ⚠️
.../Abilities/Meta_Description/system-instruction.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #318      +/-   ##
=============================================
+ Coverage      57.85%   59.21%   +1.36%     
- Complexity       615      667      +52     
=============================================
  Files             46       50       +4     
  Lines           3165     3408     +243     
=============================================
+ Hits            1831     2018     +187     
- Misses          1334     1390      +56     
Flag Coverage Δ
unit 59.21% <76.95%> (+1.36%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@jeffpaul jeffpaul added this to the 0.6.0 milestone Mar 18, 2026
@jeffpaul jeffpaul modified the milestones: 0.6.0, 0.7.0 Mar 19, 2026
@jeffpaul
Copy link
Member

  1. Update experiment title to Meta Description Generation, though I'm open to collapsing this into the Excerpt Generation experiment as they're so closely related (Excerpt and Meta Description Generation)
Screenshot 2026-03-19 at 1 05 02 PM
  1. Update button text to Title Case from Sentence case
Screenshot 2026-03-19 at 1 06 46 PM
  1. Update the loading text of the Regenerate suggestions button to Generating
Screenshot 2026-03-19 at 1 11 45 PM
  1. Generating meta, clicking save on a draft post, exiting the editor, and then returning shows no meta still saved to the post. Same problem generating meta, publishing a post, exiting the editor, and then coming back into the post shows no meta saved. So something's off with saving that to the post, here's my setup: WordPress 7.0-beta5-62069 and AI Provider for Google Version 1.0.3.

I've not yet tested across the SEO plugins, will do that once the meta saving issue above is resolved as that seems like it may heavily impact the plugin compatibility/integration.

@TylerB24890
Copy link
Author

@jeffpaul

Update experiment title to Meta Description Generation, though I'm open to collapsing this into the Excerpt Generation experiment as they're so closely related (Excerpt and Meta Description Generation)

I've updated the experiment title to "Meta Description Generation" -- let me know if we should roll this up into the Excerpt UI instead.

Update button text to Title Case from Sentence case

Done.

Update the loading text of the Regenerate suggestions button to Generating

Done.

Generating meta, clicking save on a draft post, exiting the editor, and then returning shows no meta still saved to the post. Same problem generating meta, publishing a post, exiting the editor, and then coming back into the post shows no meta saved. So something's off with saving that to the post, here's my setup: WordPress 7.0-beta5-62069 and AI Provider for Google Version 1.0.3.

This is because metadata isn't saved with Drafted posts by default. I had to define the revisions_enabled => true property when registering the _meta_description meta field. This has been updated to enable revisions for this meta key so it should save with Drafted posts going forward.

@TylerB24890 TylerB24890 changed the title Feature/issue 240 seo descriptions [Feature]: Issue 240 | SEO Descriptions Mar 23, 2026
@jeffpaul jeffpaul requested a review from dkotter March 23, 2026 20:02
@jeffpaul jeffpaul self-requested a review March 23, 2026 20:02
@jeffpaul
Copy link
Member

This is because metadata isn't saved with Drafted posts by default. I had to define the revisions_enabled => true property when registering the _meta_description meta field. This has been updated to enable revisions for this meta key so it should save with Drafted posts going forward.

Still seeing this not sticking around in the Meta Description sidebar panel after clicking save (macOS 15.7.4, Firefox 148.0.2, WordPress 7.0-beta6-62088):

generate-meta-description.mp4

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.

Add meta description suggestions with optional SEO plugin integration

2 participants