ACF_Admin::maybe_show_select2_v3_deprecation_noticepublicACF 6.4.3

Notifies the user that Select2 v3 has been deprecated and will be removed.

Method of the class: ACF_Admin{}

No Hooks.

Returns

void. Nothing (null).

Usage

$ACF_Admin = new ACF_Admin();
$ACF_Admin->maybe_show_select2_v3_deprecation_notice();

Changelog

Since 6.4.3 Introduced.

ACF_Admin::maybe_show_select2_v3_deprecation_notice() code ACF 6.8.8

public function maybe_show_select2_v3_deprecation_notice() {
	// Only show to editors and above.
	if ( ! current_user_can( 'edit_others_posts' ) ) {
		return;
	}

	if ( 3 === acf_get_setting( 'select2_version' ) ) {
		$acf_plugin_name = acf_is_pro() ? 'ACF PRO' : 'ACF';
		$acf_plugin_name = '<strong>' . $acf_plugin_name . ' &mdash;</strong>';

		$text = sprintf(
			/* translators: %1$s - Plugin name, %2$s URL to documentation */
			__( '%1$s We have detected that this website is configured to use v3 of the Select2 jQuery library, which has been deprecated in favor of v4 and will be removed in a future version of ACF. <a href="%2$s" target="_blank">Learn more</a>.', 'acf' ),
			$acf_plugin_name,
			acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/select2-v3-deprecation/', 'docs', 'select2-deprecation-notice' ),
		);

		acf_add_admin_notice( $text, 'warning', false );
	}
}