Fetching with Google…

Posted in: Newspaper
Post count: 105

Hello,

Today we tried to index our website by using the option Fetching with Google. There were two problems we faced:

1. The crawl bot got a 500 on /wp-content/themes/Newspaper/
2. We don’t have any kind of ads, but while rendering our website Google reported it was blocked on the follwing Script / AJAX
* https://static.doubleclick.net/instream/ad_status.js
* https://googleads.g.doubleclick.net/pagead/id

Since we won’t be using google ads/doubleclick, is there a way to perma remove it from even trying to be rendered?

Post count: 22421

Hello,

Google doubleclick is a type of google ad so I’m not sure why it’s being detected on your end if you say you do not use any google ads. Our theme does not have any ad code if you do not place the ads yourself.
Google DFP even requires a custom implementation to work with our theme as it will not work by default.
As for the 500 error, it is an internal server error and not theme related: http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-internal-server-error-in-wordpress/

Thank you!

Post count: 105

That’s why I find it also quite weird. I double checked the ads section. Screenshot
Even running a speed test like tools.pingdom.com generated the same https://static.doubleclick.net/instream/ad_status.js

Post count: 92

Hi Bogdan,
I am also having the same internal server error as Erythros. My first reaction was to contact my hosting company about this and their response was as follows:

It looks like there is an error with the theme itself:
[23-Feb-2017 04:08:04 UTC] PHP Fatal error: Call to undefined function get_header() in
/wp-content/themes/Newspaper/index.php on line 6

I have the latest update 7.7 installed and I’m still getting the same 500 response code as I got with Newspaper 7.6. I did not have this occur with any earlier themes.

So you’re suggesting it’s a server side issue and my hosting company says it’s a theme issue. Not sure where to go from here. Hopefully the above information is helpful in some way.

Kind regards

Post count: 92

Message 2 following on from above:

Checking the error log in /public_html/mysite/wp-content/themes/Newspaper/error_log, I’m still getting the following error after updating to Newspaper 7.7.

[24-Feb-2017 03:57:40 UTC] PHP Fatal error: Call to undefined function get_header() in /home/dbs/public_html/mysite/wp-content/themes/Newspaper/index.php on line 6

Hope this helps guys. Love your theme despite the occasional hiccup 🙂

Cheers

Post count: 260

+1 same problem here since few months.

Post count: 22421

Hello,

Now I’m not sure exactly which error is the dominant one here. The first was a google DFP code and now there is a get_header.
Th google dfp is not part of the theme.
The get header error is a wp error that can be fixed like so:
https://ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/

Thank you!

Post count: 92

Hi Bogdan,

For my part, I’m not interested in the Google DFP bit. Just the header. I’ll check out the link you’ve provided and let you know how I go.

Love your work.

Cheers amigo

Post count: 92

Hi Bogdan,

According to the link you’ve provided, the suggested code to fix this is:

if (function_exists(‘get_header’)) {
get_header();
}else{
/* Redirect browser */
header(“Location: http://” . $_SERVER[‘HTTP_HOST’] . “”);
/* Make sure that code below does not get executed when we redirect. */
exit;
}; ?>

I’m using an SSL certificate so my site is served through HTTPS protocol. I’m wondering if I’d need to make sure the bit (“Location: http://” . $_SERVER[‘HTTP_HOST’]) would need to be https and HTTPS_HOST?

Thanks in advance.

Post count: 92

Hi guys,
Ok, I found another solution here, similar to above but simpler. Since nobody should be accessing your theme’s index.php directly (it’s probably a ‘bot), you can just kill the process and save the resources that a redirect would require.

This worked well and resulted in resolution of the internal server error with Google Webmaster Tools. Score!

<?php
if (function_exists(‘get_header’)) {
get_header();
} else {
die();
}
?>

Post count: 105

It seems dangerous tho. Thoughts on it, Bogdan ?

Post count: 22421

We suggest a redirect to the homepage on that link like so:

if (function_exists('get_header')) {
get_header();
}else{
header("Location: https://www.mysite.com ");
exit;
};

Thank you!

Post count: 92

Hi Bogdan,
I tried the code you provided above, but it rendered a 404 page.

I went back and checked the URL and it turns out capital letters matter!

mysite/wp-content/themes/Newspaper/ with capital N in Newspaper redirects back to my home page

mysite/wp-content/themes/newspaper/ with lower case n renders a 404 error!

Bogdan, your code does work. Thanks!

Cheers guys

  • This reply was modified 9 years by MESOTU.
Post count: 22421

Glad it works!
Have a nice day!

Post count: 105

@Bogdan

Where would I have to add the snippet you provided above, taking into consideration I am using a child theme ?

Post count: 22421

Hello,

This topic should explain better: https://forum.tagdiv.com/topic/fatal-error-due-to-newspaper-theme/

Thank you!

Viewing 16 posts - 1 through 16 (of 16 total)
You must be logged in to reply to this topic.