Title: Walker::end_lvl
Published: April 25, 2014
Last modified: April 28, 2025

---

# Walker::end_lvl( string $output, int $depth, array $args = array() )

## In this article

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

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

Ends the list of after the elements are added.

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

The $args parameter holds additional values that may be used with the child class
methods. This method finishes the list at the end of output of the elements.

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

 `$output`stringrequired

Used to append additional content (passed by reference).

`$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_lvl/?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).

This method “End Level” is run when the walker reaches the **end** of a “branch”
in the tree structure. Generally, this method is used to add the closing tag of 
a _container_ HTML element (such as </ol>, </ul>, or </div>) to $output.

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

    ```php
    public function end_lvl( &$output, $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/6.9.4/src/wp-includes/class-wp-walker.php#L78)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-walker.php#L78-L78)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/walker/end_lvl/?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_lvl/?output_format=md#changelog)󠁿

| Version | Description | 
| [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_lvl%2F)
before being able to contribute a note or feedback.