Title: Walker::end_el
Published: April 25, 2014
Last modified: May 20, 2026

---

# Walker::end_el( string $output, object $data_object, int $depth, array $args = array() )

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#wp--skip-link--target)

Ends the element output, if needed.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#description)󠁿

The $args parameter holds additional values that may be used with the child class
methods.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#parameters)󠁿

 `$output`stringrequired

Used to append additional content (passed by reference).

`$data_object`objectrequired

The data object.

`$depth`intrequired

Depth of the item.

`$args`arrayoptional

An array of additional arguments.

Default:`array()`

## 󠀁[More Information](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#more-information)󠁿

This method is **abstract** and should be explicitly defined in the child class,
as needed. Also note that $output is passed by reference, so any changes made to
the variable within the following methods are automatically handled (no return, 
echo, or print needed).

“End Element”. Generally, this method is used to add any closing HTML tag for a 
single tree item (such as </li>, </span>, or </a>) to $output. Note that elements
are not ended until after all of their children have been added.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#source)󠁿

    ```php
    public function end_el( &$output, $data_object, $depth = 0, $args = array() ) {}
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-walker.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-walker.php#L112)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-walker.php#L112-L112)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#related)󠁿

| Used by | Description | 
| [Walker::display_element()](https://developer.wordpress.org/reference/classes/walker/display_element/)`wp-includes/class-wp-walker.php` |

Traverses elements to create list from elements.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/Walker/end_el/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Renamed `$object` (a PHP reserved keyword) to `$data_object` for PHP 8 named parameter support. | 
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwalker%2Fend_el%2F)
before being able to contribute a note or feedback.