Index: src/wp-includes/general-template.php
===================================================================
--- src/wp-includes/general-template.php	(revision 44674)
+++ src/wp-includes/general-template.php	(working copy)
@@ -112,6 +112,38 @@
 }
 
 /**
+ * Determines whether a template part exists.
+ *
+ * Checks the named template part for a theme or, if a name is specified, a
+ * specialised part will be checked. If the theme contains no {slug}.php file
+ * then this returns false.
+ *
+ * For the $name parameter, if the file is called "{slug}-special.php" then specify
+ * "special".
+ *
+ * For more information on similar theme functions, check out
+ * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
+ * Conditional Tags} article in the Theme Developer Handbook.
+ *
+ * @since 5.2.0
+ *
+ * @param string      $slug The slug name for the generic template.
+ * @param string|null $name Optional. The name of the specialised template. Default null.
+ *
+ * @return bool Whether the template part exists.
+ */
+function has_template_part( $slug, $name = null ) {
+	$templates = array();
+	$name      = (string) $name;
+	if ( '' !== $name ) {
+		$templates[] = "{$slug}-{$name}.php";
+	}
+	$templates[] = "{$slug}.php";
+
+	return (bool) locate_template( $templates, false, false );
+}
+
+/**
  * Loads a template part into a template.
  *
  * Provides a simple mechanism for child themes to overload reusable sections of code
