WPSEO_Options::clean_up()public staticYoast 1.0

Run the clean up routine for one or all options.

Метод класса: WPSEO_Options{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WPSEO_Options::clean_up( $option_name, $current_version );
$option_name(массив|строка|null)
the option you want to clean or an array of option names for the options you want to clean. If not set, all options will be cleaned.
По умолчанию: null
$current_version(строка|null)
Version from which to upgrade, if not set, version specific upgrades will be disregarded.
По умолчанию: null

Код WPSEO_Options::clean_up() Yoast 22.4

public static function clean_up( $option_name = null, $current_version = null ) {
	if ( isset( $option_name ) && is_string( $option_name ) && $option_name !== '' ) {
		if ( isset( static::$option_instances[ $option_name ] ) ) {
			static::$option_instances[ $option_name ]->clean( $current_version );
		}
	}
	elseif ( isset( $option_name ) && is_array( $option_name ) && $option_name !== [] ) {
		foreach ( $option_name as $option ) {
			if ( isset( static::$option_instances[ $option ] ) ) {
				static::$option_instances[ $option ]->clean( $current_version );
			}
		}
		unset( $option );
	}
	else {
		foreach ( static::$option_instances as $instance ) {
			$instance->clean( $current_version );
		}
		unset( $instance );

		// If we've done a full clean-up, we can safely remove this really old option.
		delete_option( 'wpseo_indexation' );
	}
}