#55218 closed defect (bug) (fixed)
WP_Comment_Query: "Column 'comment_ID' in where clause is ambiguous" when mixing 'include_unapproved' and 'meta_query'
Reported by: | genosseeinhorn | Owned by: | peterwilsoncc |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | minor | Version: | 5.9 |
Component: | Comments | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
On my site, I have a custom filter for comments_template_query_args
which sets $comment_args['meta_query']
. This works fine except when submitting a comment that needs to be approved. The result page will use the ?unapproved=
query parameter, triggering the bug.
I've created a patch which I will attach here.
Attachments (1)
Change History (12)
This ticket was mentioned in PR #2627 on WordPress/wordpress-develop by peterwilsoncc.
2 years ago
#4
#5
@
2 years ago
Thanks for the report and patch @genosseeinhorn, I can see why that is happening.
I've created linked a pull request that simply contains your patch so I can get the test suite running. I suspect some tests may need to be updated to account for the change in SQL query.
#6
@
2 years ago
- Keywords has-unit-tests added
There were no failing tests.
I've created some that fail without the patch and now pass. They're in the linked pull request too.
This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.
2 years ago
#8
@
2 years ago
The logic in the PR and unit tests looks good to me.
I added a commit to your PR to address a few docblock changes in your initial proposal :)
#10
@
2 years ago
- Owner set to peterwilsoncc
- Resolution set to fixed
- Status changed from new to closed
In 53291:
peterwilsoncc commented on PR #2627:
2 years ago
#11
Committed in https://core.trac.wordpress.org/changeset/53291
Hi there, welcome to wordpress trac, thanks for the report and patch.
Could you please provide a code(snippet) or steps to reproduce the issue?
Thanks.