[wp-trac] [WordPress Trac] #63157: wp_list_comments behaves differently when passed string or array
WordPress Trac
noreply at wordpress.org
Mon Mar 24 18:10:38 UTC 2025
#63157: wp_list_comments behaves differently when passed string or array
--------------------------+-----------------------------
Reporter: John_W_B | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 6.7.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
1. Set up Discussion so that comment does not require manual approval.
2. Put function in functions.php which prints 'your commment is waiting
approval' if
{{{
$comment->comment_approved == '0'.
}}}
and which prints the comment.
3. call that function in the theme's comment template comments.php
Result: in 6.7.1 if the function is passed as a string, e.g.
{{{
wp_list_comments("callback=my_function")
}}}
or if it is passed as an array
{{{
wp_list_comments(["callback"=>"my_function"])
}}}
Behaviour is the same.
Comments are not published unless {{{
$comment->comment_approved == '1'.
}}}
This changed in 6.7.2. Now, if the callback is passed as a string,
comments are published even if {{{
$comment->comment_approved == '0'.
}}}
However, now if the callback ias passed an array, comments are not
published if {{{
$comment->comment_approved == '0'.
}}}
I cannot see what has caused this change.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63157>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list