wp_skip_paused_themes()WP 5.2.0

Filters a given list of themes, removing any paused themes from it.

Хуков нет.

Возвращает

Строку[]. Filtered array of absolute paths to themes, without any paused themes.

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

wp_skip_paused_themes( $themes );
$themes(string[]) (обязательный)
Array of absolute theme directory paths.

Заметки

  • Global. WP_Paused_Extensions_Storage. $_paused_themes

Список изменений

С версии 5.2.0 Введена.

Код wp_skip_paused_themes() WP 6.5.2

function wp_skip_paused_themes( array $themes ) {
	$paused_themes = wp_paused_themes()->get_all();

	if ( empty( $paused_themes ) ) {
		return $themes;
	}

	foreach ( $themes as $index => $theme ) {
		$theme = basename( $theme );

		if ( array_key_exists( $theme, $paused_themes ) ) {
			unset( $themes[ $index ] );

			// Store list of paused themes for displaying an admin notice.
			$GLOBALS['_paused_themes'][ $theme ] = $paused_themes[ $theme ];
		}
	}

	return $themes;
}