diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
index d2eccbb617..009c5c9f99 100644
--- src/wp-includes/general-template.php
+++ src/wp-includes/general-template.php
@@ -17,20 +17,24 @@
  *
  * @since 1.5.0
  * @since 5.5.0 A return value was added.
+ * @since 5.5.0 $wp_tmpl_args parameter added.
  *
- * @param string $name The name of the specialised header.
+ * @param string $name         The name of the specialised header.
+ * @param array  $wp_tmpl_args Additional arguments passed to the header template.
  * @return void|false Void on success, false if the template does not exist.
  */
-function get_header( $name = null ) {
+function get_header( $name = null, $wp_tmpl_args = array() ) {
 	/**
 	 * Fires before the header template file is loaded.
 	 *
 	 * @since 2.1.0
 	 * @since 2.8.0 $name parameter added.
+	 * @since 5.5.0 $wp_tmpl_args parameter 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       $wp_tmpl_args Additional arguments passed to the header template.
 	 */
-	do_action( 'get_header', $name );
+	do_action( 'get_header', $name, $wp_tmpl_args );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -40,7 +44,7 @@ function get_header( $name = null ) {
 
 	$templates[] = 'header.php';
 
-	if ( ! locate_template( $templates, true ) ) {
+	if ( ! locate_template( $templates, true, true, $wp_tmpl_args ) ) {
 		return false;
 	}
 }
@@ -56,20 +60,24 @@ function get_header( $name = null ) {
  *
  * @since 1.5.0
  * @since 5.5.0 A return value was added.
+ * @since 5.5.0 $wp_tmpl_args parameter added.
  *
- * @param string $name The name of the specialised footer.
+ * @param string $name         The name of the specialised footer.
+ * @param array  $wp_tmpl_args Additional arguments passed to the footer template.
  * @return void|false Void on success, false if the template does not exist.
  */
-function get_footer( $name = null ) {
+function get_footer( $name = null, $wp_tmpl_args = array() ) {
 	/**
 	 * Fires before the footer template file is loaded.
 	 *
 	 * @since 2.1.0
 	 * @since 2.8.0 $name parameter added.
+	 * @since 5.5.0 $wp_tmpl_args parameter 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       $wp_tmpl_args Additional arguments passed to the footer template.
 	 */
-	do_action( 'get_footer', $name );
+	do_action( 'get_footer', $name, $wp_tmpl_args );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -79,7 +87,7 @@ function get_footer( $name = null ) {
 
 	$templates[] = 'footer.php';
 
-	if ( ! locate_template( $templates, true ) ) {
+	if ( ! locate_template( $templates, true, true, $wp_tmpl_args ) ) {
 		return false;
 	}
 }
@@ -95,20 +103,24 @@ function get_footer( $name = null ) {
  *
  * @since 1.5.0
  * @since 5.5.0 A return value was added.
+ * @since 5.5.0 $wp_tmpl_args parameter added.
  *
- * @param string $name The name of the specialised sidebar.
+ * @param string $name         The name of the specialised sidebar.
+ * @param array  $wp_tmpl_args Additional arguments passed to the sidebar template.
  * @return void|false Void on success, false if the template does not exist.
  */
-function get_sidebar( $name = null ) {
+function get_sidebar( $name = null, $wp_tmpl_args = array() ) {
 	/**
 	 * Fires before the sidebar template file is loaded.
 	 *
 	 * @since 2.2.0
 	 * @since 2.8.0 $name parameter added.
+	 * @since 5.5.0 $wp_tmpl_args parameter 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       $wp_tmpl_args Additional arguments passed to the sidebar template.
 	 */
-	do_action( 'get_sidebar', $name );
+	do_action( 'get_sidebar', $name, $wp_tmpl_args );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -118,7 +130,7 @@ function get_sidebar( $name = null ) {
 
 	$templates[] = 'sidebar.php';
 
-	if ( ! locate_template( $templates, true ) ) {
+	if ( ! locate_template( $templates, true, true, $wp_tmpl_args ) ) {
 		return false;
 	}
 }
@@ -141,12 +153,14 @@ function get_sidebar( $name = null ) {
  *
  * @since 3.0.0
  * @since 5.5.0 A return value was added.
+ * @since 5.5.0 $wp_tmpl_args parameter 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  $wp_tmpl_args Additional arguments passed to the template.
  * @return void|false Void on success, false if the template does not exist.
  */
-function get_template_part( $slug, $name = null ) {
+function get_template_part( $slug, $name = null, $wp_tmpl_args = array() ) {
 	/**
 	 * Fires before the specified template part file is loaded.
 	 *
@@ -154,11 +168,13 @@ function get_template_part( $slug, $name = null ) {
 	 * for the generic template part.
 	 *
 	 * @since 3.0.0
+	 * @since 5.5.0 $wp_tmpl_args parameter 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       $wp_tmpl_args Additional arguments passed to the template.
 	 */
-	do_action( "get_template_part_{$slug}", $slug, $name );
+	do_action( "get_template_part_{$slug}", $slug, $name, $wp_tmpl_args );
 
 	$templates = array();
 	$name      = (string) $name;
@@ -172,14 +188,16 @@ function get_template_part( $slug, $name = null ) {
 	 * Fires before a template part is loaded.
 	 *
 	 * @since 5.2.0
+	 * @since 5.5.0 $wp_tmpl_args parameter added.
 	 *
-	 * @param string   $slug      The slug name for the generic template.
-	 * @param string   $name      The name of the specialized template.
-	 * @param string[] $templates Array of template files to search for, in order.
+	 * @param string   $slug         The slug name for the generic template.
+	 * @param string   $name         The name of the specialized template.
+	 * @param string[] $templates    Array of template files to search for, in order.
+	 * @param array    $wp_tmpl_args Additional arguments passed to the template.
 	 */
-	do_action( 'get_template_part', $slug, $name, $templates );
+	do_action( 'get_template_part', $slug, $name, $templates, $wp_tmpl_args );
 
-	if ( ! locate_template( $templates, true, false ) ) {
+	if ( ! locate_template( $templates, true, false, $wp_tmpl_args ) ) {
 		return false;
 	}
 }
@@ -220,10 +238,13 @@ function get_search_form( $args = array() ) {
 	 *
 	 * @since 2.7.0 as 'get_search_form' action.
 	 * @since 3.6.0
+	 * @since 5.5.0 $args parameter added.
+	 *
+	 * @param array $args The array of arguments for building the search form.
 	 *
 	 * @link https://core.trac.wordpress.org/ticket/19321
 	 */
-	do_action( 'pre_get_search_form' );
+	do_action( 'pre_get_search_form', $args );
 
 	$echo = true;
 
@@ -262,11 +283,13 @@ function get_search_form( $args = array() ) {
 	 * Filters the HTML format of the search form.
 	 *
 	 * @since 3.6.0
+	 * @since 5.5.0 $args parameter added.
 	 *
 	 * @param string $format The type of markup to use in the search form.
 	 *                       Accepts 'html5', 'xhtml'.
+	 * @param array  $args   The array of arguments for building the search form.
 	 */
-	$format = apply_filters( 'search_form_format', $format );
+	$format = apply_filters( 'search_form_format', $format, $args );
 
 	$search_form_template = locate_template( 'searchform.php' );
 
@@ -308,10 +331,12 @@ function get_search_form( $args = array() ) {
 	 * Filters the HTML output of the search form.
 	 *
 	 * @since 2.7.0
+	 * @since 5.5.0 $args parameter added.
 	 *
 	 * @param string $form The search form HTML output.
+	 * @param array $args The array of arguments for building the search form.
 	 */
-	$result = apply_filters( 'get_search_form', $form );
+	$result = apply_filters( 'get_search_form', $form, $args );
 
 	if ( null === $result ) {
 		$result = $form;
diff --git src/wp-includes/template.php src/wp-includes/template.php
index 51a4c86358..04a5027862 100644
--- src/wp-includes/template.php
+++ src/wp-includes/template.php
@@ -644,13 +644,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.5.0 $wp_tmpl_args parameter 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        $wp_tmpl_args   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, $wp_tmpl_args = array() ) {
 	$located = '';
 	foreach ( (array) $template_names as $template_name ) {
 		if ( ! $template_name ) {
@@ -669,7 +671,7 @@ function locate_template( $template_names, $load = false, $require_once = true )
 	}
 
 	if ( $load && '' !== $located ) {
-		load_template( $located, $require_once );
+		load_template( $located, $require_once, $wp_tmpl_args );
 	}
 
 	return $located;
@@ -683,6 +685,7 @@ function locate_template( $template_names, $load = false, $require_once = true )
  * also available.
  *
  * @since 1.5.0
+ * @since 5.5.0 $wp_tmpl_args parameter added.
  *
  * @global array      $posts
  * @global WP_Post    $post          Global post object.
@@ -698,8 +701,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  $wp_tmpl_args   Additional arguments passed to the template.
  */
-function load_template( $_template_file, $require_once = true ) {
+function load_template( $_template_file, $require_once = true, $wp_tmpl_args = 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 tests/phpunit/data/themedir1/theme1/header.php tests/phpunit/data/themedir1/theme1/header.php
new file mode 100644
index 0000000000..9da09ebcb3
--- /dev/null
+++ tests/phpunit/data/themedir1/theme1/header.php
@@ -0,0 +1,2 @@
+<?php
+echo json_encode( $wp_tmpl_args );
diff --git tests/phpunit/tests/general/template.php tests/phpunit/tests/general/template.php
index e387a49944..0871cbd290 100644
--- tests/phpunit/tests/general/template.php
+++ tests/phpunit/tests/general/template.php
@@ -678,4 +678,12 @@ class Tests_General_Template extends WP_UnitTestCase {
 	function test_get_template_part_returns_false_on_failure() {
 		$this->assertFalse( get_template_part( 'non-existing-template' ) );
 	}
+
+	/**
+	 * @ticket 21676
+	 */
+	function test_load_template_with_params() {
+		load_template( DIR_TESTDATA . '/themedir1/theme1/header.php', false, array( 'foo' => 'baz' ) );
+		$this->expectOutputString( '{"foo":"baz"}' );
+	}
 }
