WP_Theme::get_allowed_on_network() WordPress Method

The WP_Theme::get_allowed_on_network() method allows a theme to be specified as allowed on a network. This is useful for networks that need to restrict the choice of themes that site admins can install. Themes can be allowed on a network by adding the following code to their functions.php file: add_filter( 'allowed_on_network', 'my_theme_allowed_on_network' ); function my_theme_allowed_on_network( $allowed_themes ) { $allowed_themes[] = 'my-theme'; return $allowed_themes; }

WP_Theme::get_allowed_on_network() #

Returns array of stylesheet names of themes allowed on the network.


Return

(string[]) Array of stylesheet names.


Top ↑

Source

File: wp-includes/class-wp-theme.php

	public static function get_allowed_on_network() {
		static $allowed_themes;
		if ( ! isset( $allowed_themes ) ) {
			$allowed_themes = (array) get_site_option( 'allowedthemes' );
		}

		/**
		 * Filters the array of themes allowed on the network.
		 *
		 * @since MU (3.0.0)
		 *
		 * @param string[] $allowed_themes An array of theme stylesheet names.
		 */
		$allowed_themes = apply_filters( 'allowed_themes', $allowed_themes );

		return $allowed_themes;
	}


Top ↑

Changelog

Changelog
VersionDescription
3.4.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.