WP_Theme::is_allowed() public WP 3.4.0
Whether the theme is allowed (multisite only).
{} It's a 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. |
Code of WP_Theme::is_allowed() WP Theme::is allowed WP 5.6
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;
}