Walker_Comment::end_el() WordPress Method

The Walker_Comment::end_el() method is used to end the element for a given comment. This is typically called by the WordPress comment walker when it has finished walking through all the comments for a given post.

Walker_Comment::end_el( string $output, WP_Comment $data_object, int $depth, array $args = array() ) #

Ends the element output, if needed.


Description

Top ↑

See also


Top ↑

Parameters

$output

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

$data_object

(WP_Comment)(Required)Comment data object.

$depth

(int)(Optional) Depth of the current comment. Default 0.

$args

(array)(Optional) An array of arguments.

Default value: array()


Top ↑

Source

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

	public function end_el( &$output, $data_object, $depth = 0, $args = array() ) {
		if ( ! empty( $args['end-callback'] ) ) {
			ob_start();
			call_user_func(
				$args['end-callback'],
				$data_object, // The current comment object.
				$args,
				$depth
			);
			$output .= ob_get_clean();
			return;
		}
		if ( 'div' === $args['style'] ) {
			$output .= "</div><!-- #comment-## -->\n";
		} else {
			$output .= "</li><!-- #comment-## -->\n";
		}
	}

Top ↑

Changelog

Changelog
VersionDescription
5.9.0Renamed $comment to $data_object to match parent class for PHP 8 named parameter support.
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.