is_site_meta_supported()WP 5.1.0

Determines whether site meta is enabled.

This function checks whether the 'blogmeta' database table exists. The result is saved as a setting for the main network, making it essentially a global setting. Subsequent requests will refer to this setting instead of running the query.

Хуков нет.

Возвращает

true|false. True if site meta is supported, false otherwise.

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

is_site_meta_supported();

Заметки

  • Global. wpdb. $wpdb WordPress database abstraction object.

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

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

Код is_site_meta_supported() WP 6.6.2

function is_site_meta_supported() {
	global $wpdb;

	if ( ! is_multisite() ) {
		return false;
	}

	$network_id = get_main_network_id();

	$supported = get_network_option( $network_id, 'site_meta_supported', false );
	if ( false === $supported ) {
		$supported = $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->blogmeta}'" ) ? 1 : 0;

		update_network_option( $network_id, 'site_meta_supported', $supported );
	}

	return (bool) $supported;
}