get_blog_list
函数
get_blog_list ( $start = 0, $num = 10, $deprecated = '' )
- 参数
-
-
(int)
$start
Optional. Offset for retrieving the blog list. Default 0.- Required: 否
-
(int)
$num
Optional. Number of blogs to list. Default 10.- Required: 否
- Default: 10
-
(string)
$deprecated
Unused.- Required: 否
- Default: (empty)
-
(int)
- 相关
-
- wp_get_sites()
- 定义位置
-
-
wp-includes/ms-deprecated.php
, line 186
-
wp-includes/ms-deprecated.php
- 引入
- –
- 弃用
- 3.0.0
Deprecated functionality to retrieve a list of all sites.
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' ); global $wpdb; $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id() ), ARRAY_A ); $blog_list = array(); foreach ( (array) $blogs as $details ) { $blog_list[ $details['blog_id'] ] = $details; $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" ); } if ( ! $blog_list ) { return array(); } if ( 'all' === $num ) { return array_slice( $blog_list, $start, count( $blog_list ) ); } else { return array_slice( $blog_list, $start, $num ); } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。