Tribe__Plugins::is_active( string $plugin_name )

Checks if given plugin is active. Usually a The Events Calendar plugin.


Parameters

$plugin_name

(string) (Required) The name of the plugin. Each plugin defines their name upon hooking on the filter.


Top ↑

Return

(bool) True if plugin is active. False if plugin is not active.


Top ↑

Source

File: src/Tribe/Plugins.php

		public static function is_active( $plugin_name ) {
			if ( ! did_action( "plugins_loaded" ) ) {
				_doing_it_wrong(
					__METHOD__,
					__( 'Using this function before "plugins_loaded" action has fired can return unreliable results.', 'tribe-common' ),
					'TBD'
				);
			}

			/**
			 * Filters the array that each Tribe plugin overrides to
			 * set itself as active when this function is called.
			 *
			 * @example [ 'the-events-calendar' => true, 'event-tickets' => true ]
			 *
			 * @since   4.12.1
			 *
			 * @return array Plugin slugs as keys and bool as value for whether it's active or not.
			 */
			$plugins = apply_filters( 'tribe_active_plugins', [] );

			return isset( $plugins[ $plugin_name ] ) && tribe_is_truthy( $plugins[ $plugin_name ] );
		}

Top ↑

Changelog

Changelog
Version Description
4.12.1 Introduced.