global_terms_enabled() WordPress Function

The global_terms_enabled() function is used to check if the global terms feature is enabled. This feature allows terms to be shared across all sites in a multisite installation.

global_terms_enabled() #

Determine whether global terms are enabled.


Return

(bool) True if multisite and global terms enabled.


Top ↑

Source

File: wp-includes/functions.php

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

	static $global_terms = null;
	if ( is_null( $global_terms ) ) {

		/**
		 * Filters whether global terms are enabled.
		 *
		 * Returning a non-null value from the filter will effectively short-circuit the function
		 * and return the value of the 'global_terms_enabled' site option instead.
		 *
		 * @since 3.0.0
		 *
		 * @param null $enabled Whether global terms are enabled.
		 */
		$filter = apply_filters( 'global_terms_enabled', null );
		if ( ! is_null( $filter ) ) {
			$global_terms = (bool) $filter;
		} else {
			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
		}
	}
	return $global_terms;
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.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