WP_Theme::is_allowed()
Determines whether the theme is allowed (multisite only).
Method of the class: WP_Theme{}
No Hooks.
Return
true|false
. Whether the theme is allowed for the network. Returns true in single-site.
Usage
$WP_Theme = new WP_Theme(); $WP_Theme->is_allowed( $check, $blog_id );
- $check(string)
- Whether to check only the 'network'-wide settings, the 'site' settings, or 'both'.
Default: 'both' - $blog_id(int)
- Ignored if only network-wide settings are checked.
Default: current site
Changelog
Since 3.4.0 | Introduced. |
WP_Theme::is_allowed() WP Theme::is allowed code WP 6.5.2
public function is_allowed( $check = 'both', $blog_id = null ) { if ( ! is_multisite() ) { return true; } if ( 'both' === $check || 'network' === $check ) { $allowed = self::get_allowed_on_network(); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; } } if ( 'both' === $check || 'site' === $check ) { $allowed = self::get_allowed_on_site( $blog_id ); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; } } return false; }