get_site_transient

Definition:
function get_site_transient( $transient ) {}

Get the value of a site transient.
If the transient does not exist or does not have a value, then the return value will be false.

Parameters

  • string $transient: Transient name. Expected to not be SQL-escaped.

Return values

returns:Value of transient

Defined filters

  • pre_site_transient_$transient
    apply_filters( 'pre_site_transient_' . $transient, false )
  • site_transient_$transient
    apply_filters( 'site_transient_' . $transient, $value )

Source code

function get_site_transient( $transient ) {

	global $_wp_using_ext_object_cache;



	$pre = apply_filters( 'pre_site_transient_' . $transient, false );

	if ( false !== $pre )

		return $pre;



	if ( $_wp_using_ext_object_cache ) {

		$value = wp_cache_get( $transient, 'site-transient' );

	} else {

		// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.

		$no_timeout = array('update_core', 'update_plugins', 'update_themes');

		$transient_option = '_site_transient_' . $transient;

		if ( ! in_array( $transient, $no_timeout ) ) {

			$transient_timeout = '_site_transient_timeout_' . $transient;

			$timeout = get_site_option( $transient_timeout );

			if ( false !== $timeout && $timeout < time() ) {

				delete_site_option( $transient_option  );

				delete_site_option( $transient_timeout );

				return false;

			}

		}



		$value = get_site_option( $transient_option );

	}



	return apply_filters( 'site_transient_' . $transient, $value );

}

1699

get_site_option

Definition:
function get_site_option( $option, $default = false, $use_cache = true ) {}

Retrieve site option value based on name of option.

Parameters

  • string $option: Name of option to retrieve. Expected to not be SQL-escaped.
  • mixed $default: Optional value to return if option doesn’t exist. Default false.
  • bool $use_cache: Whether to use cache. Multisite only. Default true.

Return values

returns:Value set for the option.

Defined filters

  • pre_site_option_$option
    apply_filters( 'pre_site_option_' . $option, false )

Source code

function get_site_option( $option, $default = false, $use_cache = true ) {

	global $wpdb;



	// Allow plugins to short-circuit site options.

 	$pre = apply_filters( 'pre_site_option_' . $option, false );

 	if ( false !== $pre )

 		return $pre;



	if ( !is_multisite() ) {

		$value = get_option($option, $default);

	} else {

		$cache_key = "{$wpdb->siteid}:$option";

		if ( $use_cache )

			$value = wp_cache_get($cache_key, 'site-options');



		if ( !isset($value) || (false === $value) ) {

			$row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );



			// Has to be get_row instead of get_var because of funkiness with 0, false, null values

			if ( is_object( $row ) ) {

				$value = $row->meta_value;

				$value = maybe_unserialize( $value );

				wp_cache_set( $cache_key, $value, 'site-options' );

			} else {

				$value = $default;

			}

		}

	}

1697

get_site_allowed_themes

Definition:
function get_site_allowed_themes() {}

Source code

function get_site_allowed_themes() {

	$themes = get_themes();

	$allowed_themes = get_site_option( 'allowedthemes' );

	if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {

		$allowed_themes = get_site_option( 'allowed_themes' ); // convert old allowed_themes format

		if ( !is_array( $allowed_themes ) ) {

			$allowed_themes = array();

		} else {

			foreach( (array) $themes as $key => $theme ) {

				$theme_key = esc_html( $theme['Stylesheet'] );

				if ( isset( $allowed_themes[ $key ] ) == true ) {

					$allowedthemes[ $theme_key ] = 1;

				}

			}

			$allowed_themes = $allowedthemes;

		}

	}

	return $allowed_themes;

}

1695

get_sitestats

Definition:
function get_sitestats() {}

Gets the network’s site and user counts.

Return values

returns:Site and user count for the network.

Source code

function get_sitestats() {

	global $wpdb;



	$stats = array(

		'blogs' => get_blog_count(),

		'users' => get_user_count(),

	);



	return $stats;

}

1693

get_single_template

Definition:
function get_single_template() {}

Retrieve path of single template in current or parent template.

Source code

function get_single_template() {

	$object = get_queried_object();



	$templates = array();



	$templates[] = "single-{$object->post_type}.php";

1691