wp_skip_paused_themes() WordPress Function

The wp_skip_paused_themes() function allows you to skip over any paused themes when iterating through themes with the WordPress get_themes() function. This is useful if you want to hide any paused themes from your users.

wp_skip_paused_themes( string[] $themes ) #

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


Parameters

$themes

(string[])(Required)Array of absolute theme directory paths.


Top ↑

Return

(string[]) Filtered array of absolute paths to themes, without any paused themes.


Top ↑

Source

File: wp-includes/load.php

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;
}


Top ↑

Changelog

Changelog
VersionDescription
5.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.