最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is mature Multisite

programmeradmin1浏览0评论

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 1
Add a comment  | 

1 Answer 1

Reset to default 0

The 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论