mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Themes: Relocate actions firing prior to and after template loading.
This relocates the actions `wp_before_load_template` and `wp_after_load_template` to fire within the `load_template()` function. Prior to this change the actions fired in the `locate_template()` function. Follow up to [53560]. Props johnjamesjacoby, johnbillion. Fixes #54541. Built from https://develop.svn.wordpress.org/trunk@54270 git-svn-id: http://core.svn.wordpress.org/trunk@53829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3b68d37905
commit
a0cefe8a20
@ -715,31 +715,7 @@ function locate_template( $template_names, $load = false, $require_once = true,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $load && '' !== $located ) {
|
if ( $load && '' !== $located ) {
|
||||||
/**
|
|
||||||
* Fires before a located template is loaded.
|
|
||||||
*
|
|
||||||
* @since 6.1.0
|
|
||||||
*
|
|
||||||
* @param string $located The template filename.
|
|
||||||
* @param string|array $template_names Template file(s) to search for, in order.
|
|
||||||
* @param bool $require_once Whether to require_once or require.
|
|
||||||
* @param array $args Additional arguments passed to the template.
|
|
||||||
*/
|
|
||||||
do_action( 'wp_before_load_template', $located, $template_names, $require_once, $args );
|
|
||||||
|
|
||||||
load_template( $located, $require_once, $args );
|
load_template( $located, $require_once, $args );
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires after a located template is loaded.
|
|
||||||
*
|
|
||||||
* @since 6.1.0
|
|
||||||
*
|
|
||||||
* @param string $located The template filename.
|
|
||||||
* @param string|array $template_names Template file(s) to search for, in order.
|
|
||||||
* @param bool $require_once Whether to require_once or require.
|
|
||||||
* @param array $args Additional arguments passed to the template.
|
|
||||||
*/
|
|
||||||
do_action( 'wp_after_load_template', $located, $template_names, $require_once, $args );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $located;
|
return $located;
|
||||||
@ -792,9 +768,31 @@ function load_template( $_template_file, $require_once = true, $args = array() )
|
|||||||
$s = esc_attr( $s );
|
$s = esc_attr( $s );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires before a template file is loaded.
|
||||||
|
*
|
||||||
|
* @since 6.1.0
|
||||||
|
*
|
||||||
|
* @param string $_template_file The full path to the template file.
|
||||||
|
* @param bool $require_once Whether to require_once or require.
|
||||||
|
* @param array $args Additional arguments passed to the template.
|
||||||
|
*/
|
||||||
|
do_action( 'wp_before_load_template', $_template_file, $require_once, $args );
|
||||||
|
|
||||||
if ( $require_once ) {
|
if ( $require_once ) {
|
||||||
require_once $_template_file;
|
require_once $_template_file;
|
||||||
} else {
|
} else {
|
||||||
require $_template_file;
|
require $_template_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires after a template file is loaded.
|
||||||
|
*
|
||||||
|
* @since 6.1.0
|
||||||
|
*
|
||||||
|
* @param string $_template_file The full path to the template file.
|
||||||
|
* @param bool $require_once Whether to require_once or require.
|
||||||
|
* @param array $args Additional arguments passed to the template.
|
||||||
|
*/
|
||||||
|
do_action( 'wp_after_load_template', $_template_file, $require_once, $args );
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.1-alpha-54269';
|
$wp_version = '6.1-alpha-54270';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user