WordPress.org

Make WordPress Core

Ticket #18803: 18803.2.diff

File 18803.2.diff, 1.0 KB (added by obenland, 7 years ago)

Updated patch

  • src/wp-includes/template.php

     
    494494function load_template( $_template_file, $require_once = true ) {
    495495        global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
    496496
    497         if ( is_array( $wp_query->query_vars ) )
     497        $pre = apply_filters( 'pre_load_template', false, $_template_file, $require_once );
     498        if ( false !== $pre ) {
     499                return $pre;
     500        }
     501
     502        if ( is_array( $wp_query->query_vars ) ) {
    498503                extract( $wp_query->query_vars, EXTR_SKIP );
     504        }
     505
     506        do_action( 'load_template_pre_require', $_template_file, $require_once );
     507
     508        if ( $require_once ) {
     509                require_once $_template_file;
     510        } else {
     511                require $_template_file;
     512        }
    499513
    500         if ( $require_once )
    501                 require_once( $_template_file );
    502         else
    503                 require( $_template_file );
     514        do_action( 'load_template_post_require', $_template_file, $require_once );
    504515}
    505516