There is a URL shown in page source code that returns a page with below error message. This shows as error in Google Search Console as crawlable URL without a 404.
Fatal error: Call to undefined function get_header() in /home/*****/public_html/*****/wp-content/themes/Newspaper/index.php on line 6
(function(){
var html_jquery_obj = jQuery(‘html’);
if (html_jquery_obj.length && (html_jquery_obj.is(‘.ie8’) || html_jquery_obj.is(‘.ie9’))) {
var path = ‘http://*****/wp-content/themes/Newspaper/style.css’;
jQuery.get(path, function(data) {
var str_split_separator = ‘#td_css_split_separator’;
var arr_splits = data.split(str_split_separator);
var arr_length = arr_splits.length;
if (arr_length > 1) {
var dir_path = ‘http://*****/wp-content/themes/Newspaper’;
var splited_css = ”;
for (var i = 0; i < arr_length; i++) {
if (i > 0) {
arr_splits[i] = str_split_separator + ‘ ‘ + arr_splits[i];
}
//jQuery(‘head’).append(‘<style>’ + arr_splits[i] + ‘</style>’);
var formated_str = arr_splits[i].replace(/\surl\(\'(?!data\:)/gi, function regex_function(str) {
return ‘ url(\” + dir_path + ‘/’ + str.replace(/url\(\’/gi, ”).replace(/^\s+|\s+$/gm,”);
});
splited_css += “<style>” + formated_str + “</style>”;
}
var td_theme_css = jQuery(‘link#td-theme-css’);
if (td_theme_css.length) {
td_theme_css.after(splited_css);
}
}
});
}
})();
Hi
This errors happens when you try to access the theme’s index.php file directly, usually it displays a Fatal error: Call to undefined function get_header() and it shouldn’t be picked up by google’s crawler.
You can find more info about this in this tread: https://forum.tagdiv.com/topic/fatal-error-3/ and add a redirect rule for it.
Hope this help.
Thanks!
Thank you for reply Andrei,
Google’s crawler is picking up Soft 404 = https://support.google.com/webmasters/answer/2409443?ctx=MCE&ctx=S4
Please can you advise correct RewriteCond and RewriteRule:
http://*****/wp-content/themes/Newspaper/
So sends to 404 instead of page with this message:
Fatal error: Call to undefined function get_header() in /home/*****/public_html/*****/wp-content/themes/Newspaper/index.php on line 6
Hi
Please try the solution indicated here: https://ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/ Basically you need to edit every file which contains get_header function.
Thanks!