wp_filter_comment

Definition:
function wp_filter_comment($commentdata) {}

Filters and sanitizes comment data.
Sets the comment data ‘filtered’ field to true when finished. This can be checked as to whether the comment should be filtered and to keep from filtering the same comment more than once.

Parameters

  • array $commentdata: Contains information on the comment.

Return values

returns:Parsed comment information.

Defined filters

  • pre_user_id
    apply_filters('pre_user_id', $commentdata['user_ID'])
  • pre_user_id
    apply_filters('pre_user_id', $commentdata['user_id'])
  • pre_comment_user_agent
    apply_filters('pre_comment_user_agent', ( isset( $commentdata['comment_agent'] )
  • pre_comment_author_name
    apply_filters('pre_comment_author_name', $commentdata['comment_author'])
  • pre_comment_content
    apply_filters('pre_comment_content', $commentdata['comment_content'])
  • pre_comment_user_ip
    apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP'])
  • pre_comment_author_url
    apply_filters('pre_comment_author_url', $commentdata['comment_author_url'])
  • pre_comment_author_email
    apply_filters('pre_comment_author_email', $commentdata['comment_author_email'])

Source code

function wp_filter_comment($commentdata) {

	if ( isset($commentdata['user_ID']) )

		$commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);

	elseif ( isset($commentdata['user_id']) )

		$commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']);

	$commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );

	$commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);

	$commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);

	$commentdata['comment_author_IP']    = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);

	$commentdata['comment_author_url']   = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);

	$commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);

	$commentdata['filtered'] = true;

	return $commentdata;

}

3653

No comments yet... Be the first to leave a reply!

Leave a comment