diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index ca2dbc0..7a356c0 100644
--- a/src/wp-includes/general-template.php
+++ b/src/wp-includes/general-template.php
@@ -16,19 +16,23 @@
  * "special".
  *
  * @since 1.5.0
+ * @since 5.0.0 $params paramenter added.
  *
- * @param string $name The name of the specialised header.
+ * @param string $name   The name of the specialised header.
+ * @param array  $params Additional arguments passed to the header template.
  */
-function get_header( $name = null ) {
+function get_header( $name = null, $params = array() ) {
 	/**
 	 * Fires before the header template file is loaded.
 	 *
 	 * @since 2.1.0
 	 * @since 2.8.0 $name parameter added.
+	 * @since 5.0.0 $params paramenter added.
 	 *
-	 * @param string|null $name Name of the specific header file to use. null for the default header.
+	 * @param string|null $name    Name of the specific header file to use. null for the default header.
+	 * @param array       $params  Additional arguments passed to the header template.
 	 */
-	do_action( 'get_header', $name );
+	do_action( 'get_header', $name, $params );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -38,7 +42,7 @@ function get_header( $name = null ) {
 
 	$templates[] = 'header.php';
 
-	locate_template( $templates, true );
+	locate_template( $templates, true, true, $params );
 }
 
 /**
@@ -51,19 +55,23 @@ function get_header( $name = null ) {
  * "special".
  *
  * @since 1.5.0
+ * @since 5.0.0 $params paramenter added.
  *
- * @param string $name The name of the specialised footer.
+ * @param string $name    The name of the specialised footer.
+ * @param array  $params  Additional arguments passed to the footer template.
  */
-function get_footer( $name = null ) {
+function get_footer( $name = null, $params = array() ) {
 	/**
 	 * Fires before the footer template file is loaded.
 	 *
 	 * @since 2.1.0
 	 * @since 2.8.0 $name parameter added.
+	 * @since 5.0.0 $params paramenter added.
 	 *
-	 * @param string|null $name Name of the specific footer file to use. null for the default footer.
+	 * @param string|null $name    Name of the specific footer file to use. null for the default footer.
+	 * @param array       $params  Additional arguments passed to the footer template.
 	 */
-	do_action( 'get_footer', $name );
+	do_action( 'get_footer', $name, $params );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -73,7 +81,7 @@ function get_footer( $name = null ) {
 
 	$templates[] = 'footer.php';
 
-	locate_template( $templates, true );
+	locate_template( $templates, true, true, $params );
 }
 
 /**
@@ -86,19 +94,23 @@ function get_footer( $name = null ) {
  * "special".
  *
  * @since 1.5.0
+ * @since 5.0.0 $params paramenter added.
  *
- * @param string $name The name of the specialised sidebar.
+ * @param string $name    The name of the specialised sidebar.
+ * @param array  $params  Additional arguments passed to the sidebar template.
  */
-function get_sidebar( $name = null ) {
+function get_sidebar( $name = null, $params = array() ) {
 	/**
 	 * Fires before the sidebar template file is loaded.
 	 *
 	 * @since 2.2.0
 	 * @since 2.8.0 $name parameter added.
+	 * @since 5.0.0 $params paramenter added.
 	 *
-	 * @param string|null $name Name of the specific sidebar file to use. null for the default sidebar.
+	 * @param string|null $name    Name of the specific sidebar file to use. null for the default sidebar.
+	 * @param array       $params  Additional arguments passed to the sidebar template.
 	 */
-	do_action( 'get_sidebar', $name );
+	do_action( 'get_sidebar', $name, $params );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -108,7 +120,7 @@ function get_sidebar( $name = null ) {
 
 	$templates[] = 'sidebar.php';
 
-	locate_template( $templates, true );
+	locate_template( $templates, true, true, $params );
 }
 
 /**
@@ -128,11 +140,13 @@ function get_sidebar( $name = null ) {
  * "special".
  *
  * @since 3.0.0
+ * @since 5.0.0 $params paramenter added.
  *
- * @param string $slug The slug name for the generic template.
- * @param string $name The name of the specialised template.
+ * @param string $slug   The slug name for the generic template.
+ * @param string $name   The name of the specialised template.
+ * @param array  $params Additional arguments passed to the template.
  */
-function get_template_part( $slug, $name = null ) {
+function get_template_part( $slug, $name = null, $params = array() ) {
 	/**
 	 * Fires before the specified template part file is loaded.
 	 *
@@ -140,11 +154,13 @@ function get_template_part( $slug, $name = null ) {
 	 * for the generic template part.
 	 *
 	 * @since 3.0.0
+	 * @since 5.0.0 $params paramenter added.
 	 *
-	 * @param string      $slug The slug name for the generic template.
-	 * @param string|null $name The name of the specialized template.
+	 * @param string      $slug   The slug name for the generic template.
+	 * @param string|null $name   The name of the specialized template.
+	 * @param array       $params Additional arguments passed to the template.
 	 */
-	do_action( "get_template_part_{$slug}", $slug, $name );
+	do_action( "get_template_part_{$slug}", $slug, $name, $params );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -154,7 +170,7 @@ function get_template_part( $slug, $name = null ) {
 
 	$templates[] = "{$slug}.php";
 
-	locate_template( $templates, true, false );
+	locate_template( $templates, true, false, $params );
 }
 
 /**
@@ -175,20 +191,25 @@ function get_template_part( $slug, $name = null ) {
  * search. To give a few examples of what it can be used for.
  *
  * @since 2.7.0
+ * @since 5.0.0 $params paramenter added.
  *
- * @param bool $echo Default to echo and not return the form.
+ * @param bool   $echo   Default to echo and not return the form.
+ * @param array  $params Additional arguments passed to the search form template.
  * @return string|void String when $echo is false.
  */
-function get_search_form( $echo = true ) {
+function get_search_form( $echo = true, $params = array() ) {
 	/**
 	 * Fires before the search form is retrieved, at the start of get_search_form().
 	 *
 	 * @since 2.7.0 as 'get_search_form' action.
 	 * @since 3.6.0
+	 * @since 5.0.0 $params paramenter added.
+	 *
+	 * @param array $params Additional arguments passed to the search form template.
 	 *
 	 * @link https://core.trac.wordpress.org/ticket/19321
 	 */
-	do_action( 'pre_get_search_form' );
+	do_action( 'pre_get_search_form', $params );
 
 	$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
 
@@ -196,11 +217,13 @@ function get_search_form( $echo = true ) {
 	 * Filters the HTML format of the search form.
 	 *
 	 * @since 3.6.0
+	 * @since 5.0.0 $params paramenter added.
 	 *
 	 * @param string $format The type of markup to use in the search form.
 	 *                       Accepts 'html5', 'xhtml'.
+	 * @param array  $params Additional arguments passed to the search form template.
 	 */
-	$format = apply_filters( 'search_form_format', $format );
+	$format = apply_filters( 'search_form_format', $format, $params );
 
 	$search_form_template = locate_template( 'searchform.php' );
 	if ( '' != $search_form_template ) {
@@ -231,10 +254,12 @@ function get_search_form( $echo = true ) {
 	 * Filters the HTML output of the search form.
 	 *
 	 * @since 2.7.0
+	 * @since 5.0.0 $params paramenter added.
 	 *
-	 * @param string $form The search form HTML output.
+	 * @param string $form   The search form HTML output.
+	 * @param array  $params Additional arguments passed to the search form template.
 	 */
-	$result = apply_filters( 'get_search_form', $form );
+	$result = apply_filters( 'get_search_form', $form, $params );
 
 	if ( null === $result ) {
 		$result = $form;
diff --git a/src/wp-includes/template.php b/src/wp-includes/template.php
index b0b49fe..86f647f 100644
--- a/src/wp-includes/template.php
+++ b/src/wp-includes/template.php
@@ -625,13 +625,15 @@ function get_attachment_template() {
  * so that themes which inherit from a parent theme can just overload one file.
  *
  * @since 2.7.0
+ * @since 5.0.0 $params paramenter added.
  *
  * @param string|array $template_names Template file(s) to search for, in order.
  * @param bool         $load           If true the template file will be loaded if it is found.
  * @param bool         $require_once   Whether to require_once or require. Default true. Has no effect if $load is false.
+ * @param array        $params         Additional arguments passed to the template.
  * @return string The template filename if one is located.
  */
-function locate_template( $template_names, $load = false, $require_once = true ) {
+function locate_template( $template_names, $load = false, $require_once = true, $params = array() ) {
 	$located = '';
 	foreach ( (array) $template_names as $template_name ) {
 		if ( ! $template_name ) {
@@ -650,7 +652,7 @@ function locate_template( $template_names, $load = false, $require_once = true )
 	}
 
 	if ( $load && '' != $located ) {
-		load_template( $located, $require_once );
+		load_template( $located, $require_once, $params );
 	}
 
 	return $located;
@@ -664,6 +666,7 @@ function locate_template( $template_names, $load = false, $require_once = true )
  * also available.
  *
  * @since 1.5.0
+ * @since 5.0.0 $params paramenter added.
  *
  * @global array      $posts
  * @global WP_Post    $post
@@ -679,8 +682,9 @@ function locate_template( $template_names, $load = false, $require_once = true )
  *
  * @param string $_template_file Path to template file.
  * @param bool   $require_once   Whether to require_once or require. Default true.
+ * @param array  $params         Additional arguments passed to the template.
  */
-function load_template( $_template_file, $require_once = true ) {
+function load_template( $_template_file, $require_once = true, $params = array() ) {
 	global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
 
 	if ( is_array( $wp_query->query_vars ) ) {
diff --git a/tests/phpunit/data/themedir1/theme1/header.php b/tests/phpunit/data/themedir1/theme1/header.php
new file mode 100644
index 0000000..cba948b
--- /dev/null
+++ b/tests/phpunit/data/themedir1/theme1/header.php
@@ -0,0 +1,2 @@
+<?php
+echo json_encode($params);
diff --git a/tests/phpunit/tests/general/template.php b/tests/phpunit/tests/general/template.php
index 05ef977..b07caf3 100644
--- a/tests/phpunit/tests/general/template.php
+++ b/tests/phpunit/tests/general/template.php
@@ -612,4 +612,12 @@ class Tests_General_Template extends WP_UnitTestCase {
 
 		$this->assertSame( $expected, $result );
 	}
+
+	/**
+	 * @ticket 21676
+	 */
+	function test_load_template_with_params () {
+		load_template( DIR_TESTDATA . '/themedir1/theme1/header.php', false, array( 'foo' => 'baz' ) );
+		$this->expectOutputString( '{"foo":"baz"}' );
+	}
 }
