public static function set_theme() {

		$stylesheet = filter_input( INPUT_GET, 'theme' );
		$theme      = wp_get_theme( $stylesheet );

		if ( $theme->exists() && $theme->is_allowed() ) {
			setcookie( self::get_cookie_name(), $theme->get_stylesheet(), strtotime( '+1 year' ), COOKIEPATH );
		}

		wp_safe_redirect( wp_get_referer() );
		die;
	}
public static function set_theme() {

		$stylesheet = filter_input( INPUT_GET, 'theme' );
		$theme      = wp_get_theme( $stylesheet );

		if ( $theme->exists() && $theme->is_allowed() ) {
			setcookie( self::get_cookie_name(), $theme->get_stylesheet(), strtotime( '+1 year' ), COOKIEPATH );
		}

		wp_safe_redirect( wp_get_referer() );
		die;
	}
public static function set_theme ( ) { $ stylesheet = filter_input ( INPUT_GET , 'theme' ) ; $ theme = wp_get_theme ( $ stylesheet ) ; if ( $ theme -> exists ( ) && $ theme -> is_allowed ( ) ) { setcookie ( self :: get_cookie_name ( ) , $ theme -> get_stylesheet ( ) , strtotime ( '+1 year' ) , COOKIEPATH ) ; } wp_safe_redirect ( wp_get_referer ( ) ) ; die ; }
Saves selected theme in cookie if valid.
Saves selected theme in cookie if valid .