is_site_meta_supported() WordPress Function

The is_site_meta_supported() function is used to check whether a given site supports meta data. This function is useful for plugin and theme developers who need to know whether a site has the ability to store and retrieve meta data.

is_site_meta_supported() #

Determines whether site meta is enabled.


Description

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.


Top ↑

Return

(bool) True if site meta is supported, false otherwise.


Top ↑

Source

File: wp-includes/functions.php

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;
}


Top ↑

Changelog

Changelog
VersionDescription
5.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More