Skip to content

Add Content Generation integration to WordPress Quick Draft widget#1012

Merged
dkotter merged 20 commits intodevelopfrom
feat/989-quick-AI-draft
Feb 10, 2026
Merged

Add Content Generation integration to WordPress Quick Draft widget#1012
dkotter merged 20 commits intodevelopfrom
feat/989-quick-AI-draft

Conversation

@faisal-alvi
Copy link
Contributor

Description of the Change

This PR integrates ClassifAI's Content Generation feature with WordPress's native Quick Draft widget on the admin dashboard. Users can now generate AI-powered content directly from the Quick Draft interface, creating new draft posts with AI-generated content based on their prompts.

989-quick-draft-AI

Key Features:

  • Adds a "Create Draft from Prompt Content" button next to the existing "Save Draft" button
  • Uses the existing Content Generation provider configured in ClassifAI settings
  • Creates new draft posts with AI-generated content while preserving the original title
  • Includes proper error handling and user feedback
  • Adds a settings toggle to enable/disable this feature (enabled by default)
  • Maintains full compatibility with existing Quick Draft functionality
image

Closes #989.

How to test the Change

  1. Enable Content Generation:

    • Go to ClassifAI Settings → Content Generation
    • Configure a provider (OpenAI, Azure OpenAI, etc.)
    • Ensure "Enable Quick Draft Integration" is checked (default)
  2. Test Quick Draft Integration:

    • Navigate to WordPress Admin Dashboard
    • Locate the Quick Draft widget
    • Enter a title and some content in the Content field
    • Click "Create Draft from Prompt Content" button
    • Verify a new draft post is created with AI-generated content
    • Check that the new draft appears in "Your Recent Drafts" section

Changelog Entry

Added - Content Generation integration with WordPress Quick Draft widget for streamlined AI-powered content creation

Credits

Props @jeffpaul @faisal-alvi

Checklist:

@faisal-alvi faisal-alvi self-assigned this Sep 18, 2025
@github-actions github-actions bot added this to the 3.8.0 milestone Sep 18, 2025
FILE: QuickDraftIntegration.php
-----------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 9 WARNINGS AFFECTING 16 LINES
-----------------------------------------------------------------------------------------------
  17 | ERROR | Whitespace found at end of line (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
  70 | ERROR | Whitespace found at end of line (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 128 | ERROR | Whitespace found at end of line (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 164 | WARNING | Array double arrow not aligned correctly; expected 1 space(s) between "'sanitize_callback'" and double arrow, but found 2. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 165 | WARNING | Array double arrow not aligned correctly; expected 1 space(s) between "'validate_callback'" and double arrow, but found 2. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 166 | WARNING | Array double arrow not aligned correctly; expected 7 space(s) between "'description'" and double arrow, but found 8. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 179 | ERROR | Function closing brace must go on the next line following the body; found 1 blank lines before brace (PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose)
 187 | WARNING | The method parameter $request is never used (Generic.CodeAnalysis.UnusedFunctionParameter.Found)
 255 | ERROR | Opening parenthesis of a multi-line function call must be the last content on the line (PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket)
 256 | WARNING | Array double arrow not aligned correctly; expected 2 space(s) between "'post_id'" and double arrow, but found 6. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 257 | WARNING | Array double arrow not aligned correctly; expected 1 space(s) between "'edit_url'" and double arrow, but found 5. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 258 | WARNING | Array double arrow not aligned correctly; expected 2 space(s) between "'content'" and double arrow, but found 6. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 259 | WARNING | Array double arrow not aligned correctly; expected 4 space(s) between "'title'" and double arrow, but found 8. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 260 | WARNING | Array double arrow not aligned correctly; expected 2 space(s) between "'success'" and double arrow, but found 6. (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 261 | ERROR | Closing parenthesis of a multi-line function call must be on a line by itself (PEAR.Functions.FunctionCallSignature.CloseBracketLine)
 264 | ERROR | The closing brace for the class must go on the next line after the body (PSR2.Classes.ClassDeclaration.CloseBraceAfterBody)
-----------------------------------------------------------------------------------------------
/home/runner/work/classifai/classifai/src/js/features/quick-draft/index.js
Error:    11:56  error  Insert `·`                                                                                                                                                                  prettier/prettier
Error:    17:3   error  Unexpected console statement                                                                                                                                                no-console
Error:    21:2   error  Unexpected console statement                                                                                                                                                no-console
Error:    24:46  error  Insert `·`                                                                                                                                                                  prettier/prettier
Error:    35:9   error  Variables should not be assigned until just prior its first reference. An early return statement may leave this variable unused                                             @wordpress/no-unused-vars-before-return
Error:    40:4   error  Unexpected alert                                                                                                                                                            no-alert
Error:    40:4   error  'alert' is not defined                                                                                                                                                      no-undef
Error:    45:50  error  Replace `·'classifai-generate-content'·` with `⏎↹↹↹'classifai-generate-content'⏎↹↹`                                                                                         prettier/prettier
Error:    46:1   error  Delete `↹↹`                                                                                                                                                                 prettier/prettier
Error:    49:26  error  'classifaiQuickDraft' is not defined                                                                                                                                        no-undef
Error:    51:3   error  Unexpected console statement                                                                                                                                                no-console
Error:    58:5   error  Expected property shorthand                                                                                                                                                 object-shorthand
Error:    59:5   error  Expected property shorthand                                                                                                                                                 object-shorthand
Error:    61:6   error  Replace `.then(·function` with `⏎↹↹↹.then(·function·`                                                                                                                       prettier/prettier
Error:    62:4   error  Replace `console.log(·'ClassifAI·Quick·Draft:·API·response·received',·response·);` with `↹console.log(⏎↹↹↹↹↹'ClassifAI·Quick·Draft:·API·response·received',⏎↹↹↹↹↹response`  prettier/prettier
Error:    62:4   error  Unexpected console statement                                                                                                                                                no-console
Error:    63:4   error  Insert `↹);⏎`                                                                                                                                                               prettier/prettier
Error:    64:4   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    65:5   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    66:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    67:5   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    69:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    70:5   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    72:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    73:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    74:5   error  Replace `setTimeout(·function` with `↹setTimeout(·function·`                                                                                                                prettier/prettier
Error:    75:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    75:6   error  'location' is not defined                                                                                                                                                   no-undef
Error:    76:5   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    77:4   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    78:1   error  Replace `↹↹↹↹throw·new·Error(·response.message·||·classifaiQuickDraft.error·` with `↹↹↹↹↹throw·new·Error(⏎↹↹↹↹↹↹response.message·||·classifaiQuickDraft.error⏎↹↹↹↹↹`        prettier/prettier
Error:    78:42  error  'classifaiQuickDraft' is not defined                                                                                                                                        no-undef
Error:    79:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    80:3   error  Replace `}·).catch(·function` with `↹}·)⏎↹↹↹.catch(·function·`                                                                                                              prettier/prettier
Error:    81:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    81:4   error  Unexpected console statement                                                                                                                                                no-console
Error:    82:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    82:4   error  Unexpected alert                                                                                                                                                            no-alert
Error:    82:4   error  'alert' is not defined                                                                                                                                                      no-undef
Error:    82:28  error  'classifaiQuickDraft' is not defined                                                                                                                                        no-undef
Error:    83:3   error  Replace `}·).finally(·function` with `↹}·)⏎↹↹↹.finally(·function·`                                                                                                          prettier/prettier
Error:    84:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    85:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    86:4   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:    86:27  error  'classifaiQuickDraft' is not defined                                                                                                                                        no-undef
Error:    87:1   error  Insert `↹`                                                                                                                                                                  prettier/prettier
Error:   114:53  error  Insert `·`                                                                                                                                                                  prettier/prettier
Error:   120:23  error  Insert `·`                                                                                                                                                                  prettier/prettier
@faisal-alvi faisal-alvi marked this pull request as ready for review September 19, 2025 14:25
@faisal-alvi faisal-alvi requested review from a team, dkotter and jeffpaul as code owners September 19, 2025 14:25
@github-actions github-actions bot added the needs:code-review This requires code review. label Sep 19, 2025
@faisal-alvi faisal-alvi removed request for a team and jeffpaul September 19, 2025 14:25
@jeffpaul jeffpaul modified the milestones: 3.8.0, 3.9.0 Jan 27, 2026
@jeffpaul
Copy link
Member

Punting to 3.9.0 so we can wrap up other efforts targeted for 3.8.0 and come back to wrap this up in a bit for the next major release.

…te the JS to translate strings, use domReady and add the create button
…that is no longer needed. Minor coding improvements to match what we do elsewhere
…ered properly. Don't automatically hide notices or refresh the page
dkotter
dkotter previously approved these changes Feb 10, 2026
@dkotter dkotter modified the milestones: 3.9.0, 3.8.0 Feb 10, 2026
@github-actions
Copy link

github-actions bot commented Feb 10, 2026

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@dkotter dkotter mentioned this pull request Feb 10, 2026
28 tasks
@dkotter dkotter merged commit d0e4c76 into develop Feb 10, 2026
19 checks passed
@dkotter dkotter deleted the feat/989-quick-AI-draft branch February 10, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:code-review This requires code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate Content Generation into Quick Draft widget on admin dashboard

3 participants