tribe_get_var( string $slug, null $default = null )

Returns the value of a registered variable.

Example use:

 tribe_set_var( 'tec.url', '' );

 $url = tribe_get_var( 'tec.url' );



(string) (Required) The slug of the variable registered using tribe_set_var.


(null) (Optional) The value that should be returned if the variable slug is not a registered one.

Default value: null

Top ↑


(mixed) Either the registered value or the default value if the variable is not registered.

Top ↑


File: src/Tribe/Container.php

	function tribe_get_var( $slug, $default = null ) {
		$container = Tribe__Container::init();

		try {
			$var = $container->getVar( $slug );
		} catch ( InvalidArgumentException $e ) {
			return $default;

		return $var;