Ticket #18803: 18803.3.diff
File 18803.3.diff, 2.1 KB (added by , 10 years ago) |
---|
-
src/wp-includes/template.php
494 494 function load_template( $_template_file, $require_once = true ) { 495 495 global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; 496 496 497 if ( is_array( $wp_query->query_vars ) ) 497 /** 498 * Filter whether to preempt loading the given template file. 499 * 500 * Passing a truthy value to the filter will effectively short-circuit loading 501 * of the template file, returning the given value instead. 502 * 503 * @since 4.2.0 504 * 505 * @param bool $load Whether to load the given template file. 506 * @param string $_template_file Template file to load. 507 * @param bool $require_once Whether to use `require_once` (true) or `require` (false) to load 508 * the template file. 509 */ 510 $pre = apply_filters( 'pre_load_template', false, $_template_file, $require_once ); 511 512 if ( false !== $pre ) { 513 return $pre; 514 } 515 516 if ( is_array( $wp_query->query_vars ) ) { 498 517 extract( $wp_query->query_vars, EXTR_SKIP ); 518 } 499 519 500 if ( $require_once ) 520 /** 521 * Fires immediately before a template file is loaded. 522 * 523 * @since 4.2.0 524 * 525 * @param string $_template_file Template file to load. 526 * @param bool $require_once Whether to use `require_once` (true) or `require` (false) to load 527 * the template file. 528 */ 529 do_action( 'load_template_pre_require', $_template_file, $require_once ); 530 531 if ( $require_once ) { 501 532 require_once( $_template_file ); 502 else533 } else { 503 534 require( $_template_file ); 535 } 536 537 /** 538 * Fires immediately after a template file is loaded. 539 * 540 * @since 4.2.0 541 * 542 * @param string $_template_file Template file to load. 543 * @param bool $require_once Whether to use `require_once` (true) or `require` (false) to load 544 * the template file. 545 */ 546 do_action( 'load_template_post_require', $_template_file, $require_once ); 504 547 } 505