acf_pro_display_activation_error()ACF 5.11.0

Display the stored activation error

Хуков нет.

Возвращает

null. Ничего.

Использование

acf_pro_display_activation_error();

Список изменений

С версии 5.11.0 Введена.

Код acf_pro_display_activation_error() ACF 6.0.4

function acf_pro_display_activation_error() {
	// Return if we're not in admin.
	if ( ! is_admin() ) {
		return;
	}

	// Return if the current user cannot view ACF settings.
	if ( ! acf_current_user_can_admin() ) {
		return;
	}

	// Check if the transient exists.
	$activation_data = acf_pro_get_activation_failure_transient();

	// Return if the transient does not exist.
	if ( ! $activation_data ) {
		return;
	}

	// Check if the license key is defined. If not, delete the transient.
	if ( ! defined( 'ACF_PRO_LICENSE' ) || empty( ACF_PRO_LICENSE ) || ! is_string( ACF_PRO_LICENSE ) ) {
		delete_transient( 'acf_activation_error' );
		return;
	}

	// Append a retry link if we're not already on the settings page.
	global $plugin_page;
	if ( ! $plugin_page || 'acf-settings-updates' !== $plugin_page ) {
		$nonce                    = wp_create_nonce( 'acf_retry_activation' );
		$check_again_url          = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates&acf_retry_nonce=' . $nonce );
		$activation_data['error'] = $activation_data['error'] . ' <a href="' . $check_again_url . '">' . __( 'Check Again', 'acf' ) . '</a>';
	}

	// Add a non-dismissible error message with the activation error.
	acf_add_admin_notice( acf_esc_html( $activation_data['error'] ), 'error', false );
}