Preview errors with LearnDash

Hello,

We are getting the following errors in the Cornerstone editor (at separate times):

  • Uh oh! No suitable preview area found. This could happen when a third party plugin is overriding the content area or "The Content" is not being output by the current layout.
  • The preview could not load due to the iframe response being incomplete. This is most often related to a plugin conflict, or customizations introducing a PHP error...

When it’s happening: Only when trying to edit some LearnDash lessons, but not all. If I create a new lesson from scratch, it seems to work fine until I add it to a course, then I get the first error. If I also add a topic to the lesson, then I get the second error.

When it started: We noticed last week, but haven’t had to edit a lesson in several weeks. We did not make any other changes to the site besides updating some plugins and the theme.

What I’ve done to try to figure it out:

  • Disabled all plugins except Cornerstone and LearnDash
  • Switched to the parent theme
  • Updated all plugins and theme
  • Disabled all custom code
  • Cleared cache from host, Cornerstone settings, and browser
  • Made sure that the preview URL domains and protocols match
  • Checked my debug log and error logs for errors (which normally shows what’s going on, but this time nothing)
  • Verified that the siteurl and home options are both correct, and have https protocol
  • Tried upgrading from PHP 8.0 to 8.1, 8.2, and 8.3
  • Increased the PHP memory limit to 512M
  • Increased max execution time
  • Contacted our host (GoDaddy), and they couldn’t figure it out

So how do I get to the bottom of this? Any suggestions?

Hello @tkulow,

Thank you for the very detailed post information. I was able to create a new Course.
Please see the secure note below.

Could you provide the URL of the page that you are trying to edit in Cornerstone? It is a Course or a Quiz?

Cheers.

Thank you, Rue.

I am able to create courses, lessons (which we changed the name of to activities), and topics and edit them just fine by themselves. The problem lies with the lessons (“Activities”), but only when we link them together. You can change the connections from the course builder.

image

With LearnDash you first create a course at the top level, then you add lessons to the course, and each lesson has various topics. The course builder is where you add the activities and topics to the course. Once you add the activity to the course and try to edit the activity in the Cornerstone editor, it gives the first error. Then when you add a topic underneath the activity in the course builder and try to edit the activity in the Cornerstone editor, it gives the second error. If you disconnect them in the course builder, the errors go away and you can edit the activity in Cornerstone just fine.

I hope that makes sense.

Hi there,

Thanks for writing in.

We may need to enable the WP_DEBUG mode and error logs to check the issue further. Please clone the site to a staging environment, then switch to debug mode and enable the error logs as instructed in the link above. We’ll check the issue again once the staging site is ready.

Best regards,
Ismael

I have backed up and cloned the site on the multisite network and enabled the debug log. You can view the debug log from the Developer Debug Tools tab. I’ll share the link in a secure note.

@ruenel and @Ismael,

Okay, we narrowed it down to only being an issue if you are not enrolled in the course. If you view the activity without being enrolled in the course it’s attached to, it redirects you to the course page. Once you enroll you can view the activity, and consequently able to edit it Cornerstone as well. So, the cause seems to be an issue with LearnDash trying to redirect you when editing in Cornerstone while not being enrolled. Is there a way to prevent it trying to redirect while editing in Cornerstone?

Thank you for the info.

Good thing you figured this out. So, it’s possible to enroll an admin account in a course, and you’ll be able to edit the page without issues? It might not be possible to override the conditions set by the LearnDash plugin for the visibility of their post type. In the meantime, just make sure to enroll in the course first before creating the links. We’ll try to check the issue further.

Warm regards.

Yes, that’s correct. Do you happen to have a condition in PHP that checks if you are in the Cornerstone editor preview? I know that there have been other issues with redirects causing errors, so it would be helpful if we could set things to not redirect while editing.