Skip to content

pr: [Nightly Fix] - Bug - Harden Form Creation Flow#44

Open
jewel-claw wants to merge 1 commit into
masterfrom
nightly-fix/create-form-error-handling
Open

pr: [Nightly Fix] - Bug - Harden Form Creation Flow#44
jewel-claw wants to merge 1 commit into
masterfrom
nightly-fix/create-form-error-handling

Conversation

@jewel-claw

Copy link
Copy Markdown

What

Fix the admin form creation flow so blank titles still create a default-named form and failed inserts return a proper JSON error without trying to update a non-existent post.

Why

The current handler returns early when post_title is blank, which leaves the AJAX caller without a response. It also calls wp_update_post() before checking whether Forms::create() returned a WP_Error, which can produce follow-up warnings and hides the real failure.

Fix

  • Remove the early return and keep the existing Blank Form fallback title
  • Validate the insert result before calling wp_update_post()
  • Return the existing JSON error response when the insert fails

Confidence

High. The change is small, isolated to the create-form AJAX path, and php -l passes on the modified file.

@greptile-apps

greptile-apps Bot commented Mar 20, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

@kilo-code-bot

kilo-code-bot Bot commented Mar 20, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • includes/Classes/AdminAjaxHandler.php - No issues

The changes are well-designed:

  • The early return is properly removed, allowing blank titles to use the default "Blank Form" name
  • Error checking now happens before wp_update_post(), preventing updates to non-existent posts
  • Added !$formId check alongside is_wp_error() for more robust error handling
  • The fix correctly addresses the issues described in the PR description

Reviewed by minimax-m2.5-20260211 · 119,741 tokens

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.

1 participant