bsf_get_current_version( string $template, string $type )

Get current version of plugin / theme.


Description


Parameters

$template

(string) (Required) plugin template/slug.

$type

(string) (Required) type of product.


Return

(float)


Source

File: admin/bsf-core/auto-update/admin-functions.php

	function bsf_get_current_version( $template, $type ) {
		if ( '' === $template ) {
			return false;
		}
		if ( 'theme' === $type || 'themes' === $type ) {
			$theme   = wp_get_theme( $template );
			$version = $theme->get( 'Version' );
		} elseif ( 'plugin' === $type || 'plugins' === $type ) {
			$plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template;
			if ( ! is_file( $plugin_file ) ) {
				return false;
			}
			$plugin  = get_plugin_data( $plugin_file );
			$version = $plugin['Version'];
		}
		return $version;
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.