In comment-functions.php, the function declaration is get_comments_number($comment_id). But obviouly, by looking at the code is seems that the meaning is $post_id.
In comment-functions.php, the function declaration is get_comments_number($comment_id). But obviouly, by looking at the code is seems that the meaning is $post_id.
So, what's the problem?
I haven't verified myself the values, but if commment's ID is the same as the corresponding post's ID, then everything seems to be in place, unless I miss something.
It's just the name of the variable used for the argument that's passed to the function. It could be called $whatyoutalkinaboutwillis and still work the same.
Yes, I totally agree that the code 100% functionnal. Nevertheless that's not a reason for leaving confusing names as such, in particular when it's easy to correct it.
Extensibility is not only a matter of architecture, code readability is also an import factor.
After looking at the wp_comments table, I realize you're right, Joannes.
In that table, we have column comment_id and comment_post_id, and the parameter passed to that function ($comment_id) is matched against the comment_post_id.
Unless someone looks deeper (which is supposed to be unnecessary), then the parameter name is indeed misleading. You could file a bug if you want.
"Extensibility is not only a matter of architecture, code readability is also an import factor."
A good point to make. If you had made it in the first post...
This topic has been closed to new replies.