Using WordPress ‘is_site_meta_supported()’ PHP function

The is_site_meta_supported() WordPress PHP function determines whether site meta is enabled.

Usage

$is_supported = is_site_meta_supported();

Parameters

This function has no parameters.

More information

See WordPress Developer Resources: is_site_meta_supported()

Examples

Check if site meta is supported and display a message

This example checks if site meta is supported and displays a message accordingly.

$is_supported = is_site_meta_supported();

if ($is_supported) {
    echo 'Site meta is supported.';
} else {
    echo 'Site meta is not supported.';
}

Conditionally load a plugin based on site meta support

This example loads a custom plugin only if site meta is supported.

if (is_site_meta_supported()) {
    require_once 'my_custom_plugin.php';
}

Add site meta data if site meta is supported

This example adds site meta data only if site meta is supported.

if (is_site_meta_supported()) {
    add_site_meta(1, 'custom_key', 'custom_value');
}

Update site meta data if site meta is supported

This example updates site meta data only if site meta is supported.

if (is_site_meta_supported()) {
    update_site_meta(1, 'custom_key', 'updated_value');
}

Retrieve site meta data if site meta is supported

This example retrieves site meta data only if site meta is supported.

if (is_site_meta_supported()) {
    $meta_value = get_site_meta(1, 'custom_key', true);
    echo 'Custom Key Value: ' . $meta_value;
}