do_action( 'get_sidebar', string|null $name, array $args )
- Since
- 2.2.0, 2.8.0, 5.5.0
Fires before the sidebar template file is loaded.
Compatibility
- WordPress
- since 5.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$namestring|null- Name of the specific sidebar file to use. Null for the default sidebar.
$argsarray- Additional arguments passed to the sidebar template.
Where this hook fires · 1
wp-includes/general-template.php:126get_sidebar()
Source code
* @since 2.8.0 The `$name` parameter was added. * @since 5.5.0 The `$args` parameter was added. * * @param string|null $name Name of the specific sidebar file to use. Null for the default sidebar. * @param array $args Additional arguments passed to the sidebar template. */ do_action( 'get_sidebar', $name, $args ); $templates = array(); $name = (string) $name; if ( '' !== $name ) { $templates[] = "sidebar-{$name}.php"; }Changelog
Introduced in 2.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
5.5.0
The
$args parameter was added.from the docblock2.8.0
The
$name parameter was added.from the docblock2.2.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.