Automattic\WooCommerce\Internal\Admin
LegacyReportsMenu::is_new_store
Whether the store was first installed on the version that hides the menu, or later.
Until admin_init records the initial version on a fresh install, the current version is used. A missing or malformed initial version (e.g. stores installed before 9.2.0) counts as an existing store.
Метод класса: LegacyReportsMenu{}
Хуков нет.
Возвращает
bool.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_new_store(): bool;
Код LegacyReportsMenu::is_new_store() LegacyReportsMenu::is new store WC 11.3.0
private function is_new_store(): bool {
$initial_version = get_option( WC_Install::INITIAL_INSTALLED_VERSION );
if ( false === $initial_version && 'yes' === get_option( WC_Install::NEWLY_INSTALLED_OPTION ) ) {
$initial_version = WC()->version;
}
if ( ! is_string( $initial_version ) || ! preg_match( '/^\d+\.\d+\.\d+(-(dev|alpha|beta|rc)(\.?\d+)?)?$/i', $initial_version ) ) {
return false;
}
return version_compare( $initial_version, self::NEW_STORE_VERSION, '>=' );
}