Walker_Comment::start_el( string $output, WP_Comment $data_object, int $depth, array $args = array(), int $current_object_id )

Starts the element output.


Description

See also


Parameters

$output

(Required) Used to append additional content. Passed by reference.

$data_object

(Required) Comment data object.

$depth

(Optional) Depth of the current comment in reference to parents. Default 0.

$args

(Optional) An array of arguments.

Default value: array()

$current_object_id

(Optional) ID of the current comment. Default 0.


Source

File: wp-includes/class-walker-comment.php

	public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
		$depth++;
		$GLOBALS['comment_depth'] = $depth;
		$GLOBALS['comment'] = $comment;

		if ( !empty( $args['callback'] ) ) {
			ob_start();
			call_user_func( $args['callback'], $comment, $args, $depth );
			$output .= ob_get_clean();
			return;
		}

		if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
			ob_start();
			$this->ping( $comment, $depth, $args );
			$output .= ob_get_clean();
		} elseif ( 'html5' === $args['format'] ) {
			ob_start();
			$this->html5_comment( $comment, $depth, $args );
			$output .= ob_get_clean();
		} else {
			ob_start();
			$this->comment( $comment, $depth, $args );
			$output .= ob_get_clean();
		}
	}

Changelog

Changelog
Version Description
5.9.0 Renamed $comment to $data_object and $id to $current_object_id to match parent class for PHP 8 named parameter support.
2.7.0
CP-2.0.0 Default to 'html' output for comments. Introduced. CP-2.0.0 Default to 'html' output for comments.