Sorry if this is a stupid question. I am currently learning PHP and using PHP with WordPress. Currently I am limiting the amount of characters comments on my WordPress site can be.
I have a function which uses the hook 'preprocess_comment' .
In the wordpress codex it says preprocess_comment takes one parameter which is an array called $commentdata.
function preprocess_comment_handler( $commentdata ) {
//some code
return $commentdata;
}
The function I am using gives a parameter of $comment
function nyt_preprocess_comment($comment) {
if ( strlen( $comment['comment_content'] ) > 5000 ) {
wp_die('Comment is too long.');
}
return $comment;
}
My question is do the parameters not have to have the same name? If not, how come?
Thank you