Fixing the LearnDash "Access to certificate page is disallowed" Error

This post may contain referral links which may earn a commission for this site

If you try to use the Divi Builder (backend visual builder) to edit a LearnDash certificate, you may encounter the following error: "Access to certificate page is disallowed". This error is due to an incompatibility between the way Divi Builder and LearnDash work, rather than an error in either one of them. Here's how to fix it:

Fixing the Certificate Access Error Using Divi LearnDash Kit

A fix for this issue is included in Divi LearnDash Kit. Simply install and activate Divi LearnDash Kit and the fix will automatically be applied. It is available in version 1.2.4 upwards.

Fixing the Certificate Access Error Using PHP

If you're comfortable adding PHP to your site, here's the same code used by Divi LearnDash Kit to fix the issue. Simply add it, for example, into the functions.php file of your child theme and it should take effect when you next load the certificate edit page.

// === Fix certificate editing blocked in BFB ===
// - Error in BFB: "Access to certificate page is disallowed."
add_action('template_redirect', 'dbldk_allowCertificateEditingInBfb', 9);

function dbldk_allowCertificateEditingInBfb() {
	$bfbPage = isset($_GET['et_bfb']);
	$userCanEdit = (is_user_logged_in() && function_exists('et_pb_is_allowed') && et_pb_is_allowed('edit_posts'));
	if ($bfbPage && $userCanEdit) {
		if (isset(SFWD_CPT_Instance::$instances['sfwd-quiz'])) { // Quiz CPT instance is doing the certificate access check
			remove_action('template_redirect', array(SFWD_CPT_Instance::$instances['sfwd-quiz'], 'template_redirect_access'));
		}
	}
}

Hundreds of new features for Divi
in one easy-to-use plugin

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *