Edit File by line
/home/barbar84/www/wp-inclu...
File: template-loader.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Loads the correct template based on the visitor's url
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
if ( wp_using_themes() ) {
[6] Fix | Delete
/**
[7] Fix | Delete
* Fires before determining which template to load.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 1.5.0
[10] Fix | Delete
*/
[11] Fix | Delete
do_action( 'template_redirect' );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Filters whether to allow 'HEAD' requests to generate content.
[16] Fix | Delete
*
[17] Fix | Delete
* Provides a significant performance bump by exiting before the page
[18] Fix | Delete
* content loads for 'HEAD' requests. See #14348.
[19] Fix | Delete
*
[20] Fix | Delete
* @since 3.5.0
[21] Fix | Delete
*
[22] Fix | Delete
* @param bool $exit Whether to exit without generating any content for 'HEAD' requests. Default true.
[23] Fix | Delete
*/
[24] Fix | Delete
if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) ) {
[25] Fix | Delete
exit;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
// Process feeds and trackbacks even if not using themes.
[29] Fix | Delete
if ( is_robots() ) {
[30] Fix | Delete
/**
[31] Fix | Delete
* Fired when the template loader determines a robots.txt request.
[32] Fix | Delete
*
[33] Fix | Delete
* @since 2.1.0
[34] Fix | Delete
*/
[35] Fix | Delete
do_action( 'do_robots' );
[36] Fix | Delete
return;
[37] Fix | Delete
} elseif ( is_favicon() ) {
[38] Fix | Delete
/**
[39] Fix | Delete
* Fired when the template loader determines a favicon.ico request.
[40] Fix | Delete
*
[41] Fix | Delete
* @since 5.4.0
[42] Fix | Delete
*/
[43] Fix | Delete
do_action( 'do_favicon' );
[44] Fix | Delete
return;
[45] Fix | Delete
} elseif ( is_feed() ) {
[46] Fix | Delete
do_feed();
[47] Fix | Delete
return;
[48] Fix | Delete
} elseif ( is_trackback() ) {
[49] Fix | Delete
require ABSPATH . 'wp-trackback.php';
[50] Fix | Delete
return;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
if ( wp_using_themes() ) {
[54] Fix | Delete
[55] Fix | Delete
$tag_templates = array(
[56] Fix | Delete
'is_embed' => 'get_embed_template',
[57] Fix | Delete
'is_404' => 'get_404_template',
[58] Fix | Delete
'is_search' => 'get_search_template',
[59] Fix | Delete
'is_front_page' => 'get_front_page_template',
[60] Fix | Delete
'is_home' => 'get_home_template',
[61] Fix | Delete
'is_privacy_policy' => 'get_privacy_policy_template',
[62] Fix | Delete
'is_post_type_archive' => 'get_post_type_archive_template',
[63] Fix | Delete
'is_tax' => 'get_taxonomy_template',
[64] Fix | Delete
'is_attachment' => 'get_attachment_template',
[65] Fix | Delete
'is_single' => 'get_single_template',
[66] Fix | Delete
'is_page' => 'get_page_template',
[67] Fix | Delete
'is_singular' => 'get_singular_template',
[68] Fix | Delete
'is_category' => 'get_category_template',
[69] Fix | Delete
'is_tag' => 'get_tag_template',
[70] Fix | Delete
'is_author' => 'get_author_template',
[71] Fix | Delete
'is_date' => 'get_date_template',
[72] Fix | Delete
'is_archive' => 'get_archive_template',
[73] Fix | Delete
);
[74] Fix | Delete
$template = false;
[75] Fix | Delete
[76] Fix | Delete
// Loop through each of the template conditionals, and find the appropriate template file.
[77] Fix | Delete
foreach ( $tag_templates as $tag => $template_getter ) {
[78] Fix | Delete
if ( call_user_func( $tag ) ) {
[79] Fix | Delete
$template = call_user_func( $template_getter );
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
if ( $template ) {
[83] Fix | Delete
if ( 'is_attachment' === $tag ) {
[84] Fix | Delete
remove_filter( 'the_content', 'prepend_attachment' );
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
break;
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
if ( ! $template ) {
[92] Fix | Delete
$template = get_index_template();
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
/**
[96] Fix | Delete
* Filters the path of the current template before including it.
[97] Fix | Delete
*
[98] Fix | Delete
* @since 3.0.0
[99] Fix | Delete
*
[100] Fix | Delete
* @param string $template The path of the template to include.
[101] Fix | Delete
*/
[102] Fix | Delete
$template = apply_filters( 'template_include', $template );
[103] Fix | Delete
if ( $template ) {
[104] Fix | Delete
include $template;
[105] Fix | Delete
} elseif ( current_user_can( 'switch_themes' ) ) {
[106] Fix | Delete
$theme = wp_get_theme();
[107] Fix | Delete
if ( $theme->errors() ) {
[108] Fix | Delete
wp_die( $theme->errors() );
[109] Fix | Delete
}
[110] Fix | Delete
}
[111] Fix | Delete
return;
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function