get_sidebar WordPress Action Hook

The get_sidebar hook is used to display a sidebar on a WordPress site. The sidebar can contain widgets, which are small pieces of code that add functionality to a WordPress site.

do_action( 'get_sidebar', string|null $name, array $args ) #

Fires before the sidebar template file is loaded.


Parameters

$name

(string|null)Name of the specific sidebar file to use. Null for the default sidebar.

$args

(array)Additional arguments passed to the sidebar template.


Top ↑

Source

File: wp-includes/general-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.5.0The $args parameter was added.
2.8.0The $name parameter was added.
2.2.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.

Show More
Show More