I am running a multisite. However, I want to be able to separate certain sites. The only option I see is the "mature" checkbox.
I"m not running mature sites. I wanted to add a "Premium" checkbox, but that seems impossible. So I am marking my premium blogs with the "mature" checkbox.
Is there a "is_mature()" type of function to determine if a multisite is marked mature?
I am running a multisite. However, I want to be able to separate certain sites. The only option I see is the "mature" checkbox.
I"m not running mature sites. I wanted to add a "Premium" checkbox, but that seems impossible. So I am marking my premium blogs with the "mature" checkbox.
Is there a "is_mature()" type of function to determine if a multisite is marked mature?
Share Improve this question asked May 3, 2020 at 3:18 DonCoryonDonCoryon 11 Answer
Reset to default 0The current WP_Site object is saved as global $current_blog
, so you can use
global $current_blog;
if ( isset( $current_blog ) && $current_blog->mature ) { ... }
There's no convenience helper method to fetch this as there is get_current_site()
for $current_site
; there is also get_site()
which you could use get_site()->mature
but that doesn't use the already-loaded WP_Site object.
I'd probably store the 'premium' flag in an option, though, which can be per-blog or per-site, but it depends how you want to use it e.g. I doubt you can search for blogs with a given option as easy as you can search for the 'mature' flag.