get_sidebar
Fires before the sidebar template file is loaded.
Usage
add_action( 'get_sidebar', 'wp_kama_get_sidebar_action', 10, 2 );
/**
* Function for `get_sidebar` action-hook.
*
* @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.
*
* @return void
*/
function wp_kama_get_sidebar_action( $name, $args ){
// action...
}
- $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.
Changelog
| Since 2.2.0 | Introduced. |
| Since 2.8.0 | The $name parameter was added. |
| Since 5.5.0 | The $args parameter was added. |
Where the hook is called
get_sidebar
wp-includes/general-template.php 126
do_action( 'get_sidebar', $name, $args );