acf_get_version_when_first_activated()ACF 6.3

Returns the version of ACF when it was first activated. However, if ACF was first activated prior to the introduction of the acf_first_activated_version option, this function returns false (boolean) to indicate that the version could not be determined.

Хуков нет.

Возвращает

Строку|true|false. The (string) version of ACF when it was first activated, or false (boolean) if the version could not be determined.

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

acf_get_version_when_first_activated();

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

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

Код acf_get_version_when_first_activated() ACF 6.4.2

function acf_get_version_when_first_activated() {
	// Check if ACF is network-activated on a multisite.
	if ( is_multisite() ) {
		$acf_dir_and_filename = basename( ACF_PATH ) . '/acf.php';
		$plugins              = get_site_option( 'active_sitewide_plugins' );

		if ( isset( $plugins[ $acf_dir_and_filename ] ) ) {
			$main_site_id = get_main_site_id();

			if ( empty( $main_site_id ) ) {
				return false;
			}

			// ACF is network activated, so get the version from main site's options.
			return get_blog_option( $main_site_id, 'acf_first_activated_version', false );
		}
	}

	// Check if ACF is activated on this single site.
	return get_option( 'acf_first_activated_version', false );
}