acf_get_version_when_first_activated()
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.
No Hooks.
Returns
String|true|false. The (string) version of ACF when it was first activated, or false (boolean) if the version could not be determined.
Usage
acf_get_version_when_first_activated();
Changelog
| Since 6.3 | Introduced. |
acf_get_version_when_first_activated() acf get version when first activated code ACF 6.8.8
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 );
}