Themes: Revert returning the value of locate_template()
in functions that call it.
Because the names of the `get_header()`, `get_footer()`, `get_sidebar()`, and `get_template_part()` functions indicate that a value is returned, some plugins and themes already have `echo get_template_part()` in their codebase. Adding a return value to these functions using the approach in [44678] will cause the two unintended side effects of unexpected content being sent to the browser, and accidental path disclosure. Reverts [44678]. Props davidbinda. See #40969. git-svn-id: https://develop.svn.wordpress.org/trunk@44725 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5f38ce3d98
commit
666d713c1b
@ -16,10 +16,8 @@
|
||||
* "special".
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 5.1.0 Added the return value.
|
||||
*
|
||||
* @param string $name The name of the specialised header.
|
||||
* @return string The template filename if one is located.
|
||||
*/
|
||||
function get_header( $name = null ) {
|
||||
/**
|
||||
@ -40,7 +38,7 @@ function get_header( $name = null ) {
|
||||
|
||||
$templates[] = 'header.php';
|
||||
|
||||
return locate_template( $templates, true );
|
||||
locate_template( $templates, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,10 +51,8 @@ function get_header( $name = null ) {
|
||||
* "special".
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 5.1.0 Added the return value.
|
||||
*
|
||||
* @param string $name The name of the specialised footer.
|
||||
* @return string The template filename if one is located.
|
||||
*/
|
||||
function get_footer( $name = null ) {
|
||||
/**
|
||||
@ -77,7 +73,7 @@ function get_footer( $name = null ) {
|
||||
|
||||
$templates[] = 'footer.php';
|
||||
|
||||
return locate_template( $templates, true );
|
||||
locate_template( $templates, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,10 +86,8 @@ function get_footer( $name = null ) {
|
||||
* "special".
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 5.1.0 Added the return value.
|
||||
*
|
||||
* @param string $name The name of the specialised sidebar.
|
||||
* @return string The template filename if one is located.
|
||||
*/
|
||||
function get_sidebar( $name = null ) {
|
||||
/**
|
||||
@ -114,7 +108,7 @@ function get_sidebar( $name = null ) {
|
||||
|
||||
$templates[] = 'sidebar.php';
|
||||
|
||||
return locate_template( $templates, true );
|
||||
locate_template( $templates, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,11 +128,9 @@ function get_sidebar( $name = null ) {
|
||||
* "special".
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 5.1.0 Added the return value.
|
||||
*
|
||||
* @param string $slug The slug name for the generic template.
|
||||
* @param string $name The name of the specialised template.
|
||||
* @return string The template filename if one is located.
|
||||
*/
|
||||
function get_template_part( $slug, $name = null ) {
|
||||
/**
|
||||
@ -162,7 +154,7 @@ function get_template_part( $slug, $name = null ) {
|
||||
|
||||
$templates[] = "{$slug}.php";
|
||||
|
||||
return locate_template( $templates, true, false );
|
||||
locate_template( $templates, true, false );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user