Opened 5 days ago
Last modified 4 hours ago
#65570 new feature request
Allow changing a comment's parent from the Edit Comment screen
| Reported by: | youknowriad | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Comments | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
There is currently no way to re-parent a comment (change comment_parent) through the admin UI. The only options are editing the database directly or calling the API programmatically.
On the Edit Comment screen (wp-admin/edit-form-comment.php), the parent relationship is shown as read-only text ("In reply to: …") with no way to change it. edit_comment() in wp-admin/includes/comment.php doesn't process comment_parent from the submitted form.
The data layer already fully supports this:
wp_update_comment() lists comment_parent among its updatable fields (wp-includes/comment.php).
The REST API accepts parent on a comment update, with no readonly flag (class-wp-rest-comments-controller.php).
So this is purely a missing UI control, not a data-model change.
Potential approach:
Add an "In reply to" control on the Edit Comment screen that lets the user set or clear the parent comment — a picker (or comment-ID field) scoped to other comments on the same post. An empty value means top-level.
Have edit_comment() read comment_parent from $_POST and pass it through to wp_update_comment().
Validate that the chosen parent belongs to the same post and is not the comment itself or one of its descendants, to avoid threading loops.
Notes:
- Guard against cycles (parent can't be a descendant).
- Consider thread_comments_depth implications for how the re-parented thread displays on the front end.
Change History (7)
#3
@
5 days ago
My personal opinion is that there are a lot of people that don't really use comments too much on WordPress. But for those who have blogs with long conversations, it's quite common to make mistakes and not reply to the right thread. Adjusting the parent feels like a nice thing to have.
#5
in reply to: ↑ 4
@
23 hours ago
Replying to SergeyBiryukov:
Previously: #16252
That's probably when I first asked for this. :) Most common on posts with many comments, and either by mistake or by people who want to appear further up in the thread.
Comment on the wrong post is less common, but also something you can't fix in the dashboard. Out of scope for this, though.
This ticket was mentioned in PR #12406 on WordPress/wordpress-develop by @youknowriad.
21 hours ago
#6
- Keywords has-patch has-unit-tests added
There is currently no way to re-parent a comment (change comment_parent) through the admin UI, even though the data layer fully supports it (wp_update_comment() lists comment_parent among its updatable fields, and the REST API accepts parent on update).
This PR adds an editable "In reply to" control to the Edit Comment screen:
- The "In reply to" line in the Save box is now always displayed (showing "None" for top-level comments), with an Edit toggle following the exact pattern of the "Submitted on" (timestamp) control above it.
- The picker is a
<select>of the other comments on the same post, each option labeled with the comment author and a trimmed excerpt (viaget_comment_excerpt()). The comment being edited and its descendants are excluded from the list, so a threading loop cannot even be selected. If the current parent would not otherwise be listed (e.g. a pingback, or a comment no longer publicly visible), it is appended as a selected option so saving without touching the field never re-parents the comment. edit_comment()now readscomment_parentfrom the submitted form and validates it before handing off towp_update_comment(): the parent must be another comment on the same post, and cannot be the comment itself or one of its descendants. Invalid values return aWP_Error, surfaced the same way as other comment update failures. The quick-edit AJAX path is unaffected, as its form does not submitcomment_parent.- Without JavaScript, the fieldset is simply visible and submits with the form, same as the timestamp control.
Note on UI scope: the UI is intentionally kept minimal for now (a plain select). The Edit Comment screen is a non-React admin screen, so advanced UI components (custom searchable selects/comboboxes) are hard to do well there without pulling in significant machinery. The plain select matches the existing core precedent for picking a parent (wp_dropdown_pages() in Page Attributes) and can be revisited later.
### Screenshots
| Picker open | After choosing a parent |
|---|---|
|
|
### Testing instructions
- On a post with a few (threaded) comments, go to Comments and click Edit on one of them.
- In the Save box, click Edit next to "In reply to:".
- Pick another comment — note the edited comment itself and its own replies are not offered — and click OK, then Update.
- Verify the comment is re-parented on the front end.
New PHPUnit tests cover the edit_comment() validation (re-parenting, clearing to top-level, and rejecting cross-post, nonexistent, self, child, and descendant parents): tests/phpunit/tests/admin/includes/comment/EditComment_Test.php.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable 5
Used for: Implementation, tests, and screenshots were authored with AI assistance, directed and reviewed by me.
---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code
@youknowriad commented on PR #12406:
4 hours ago
#7
Thanks for the suggestions, I applied all of them.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)


Is this a common need?