gatsbyjs / wp-gatsby

WordPress plugin for gatsby-source-wordpress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preview template not always included

nunof07 opened this issue · comments

Hi,

We're running WP Gatsby version 1.0.6 and we're getting inconsistent previews (sometimes they work, sometimes they don't).

We're using Gatsby Cloud for the preview server and Kinsta for WordPress.

When the previews don't work, it's because the preview template from the plugin is not included and instead we get the template from the theme. In Gatsby Cloud the build is finishing properly (takes about 30s).

We get inconsistent results with the same page AND the same content (different tries), so it's hard to understand why this is happening.

Do you have any ideas of what could be causing this or a way to debug this further?

Thanks for your help.

Hi there! Are you using any plugins that filter or redirect URLs on the site? Sometimes Yoast does this when pages get deleted or changed.

Since your site is already on Gatsby Cloud, could you open a support ticket from Gatsby Cloud? We'll be able to troubleshoot more from there.

I've opened a support ticked from Gatsby Cloud.

I have some more information. Debugging the WP Gatsby plugin, I can see the method setup_preview_template (from class Preview) is called, but fails to determine it's a preview because is_preview() returns false and $_GET['preview_nonce'] is not set, so it fallbacks to the default template. Not sure why this happens, I test the same page (home) several times in a row and this only occurs sometimes.

I also tried disabling Yoast SEO and for a moment I thought the issue was gone, but after many tries the issue was back 😞 .