is_multi_author
apply_filters( ‘is_multi_author’, bool $is_multi_author )
筛选挂钩:筛选网站是否有多个发布了文章的作者。
Filter Hook: Filters whether the site has more than one author with published posts.
参数(Parameters)
参数 | 类型 | 说明 |
---|---|---|
$is_multi_author | (bool) | $是否为多个作者应评估为真。 |
源码(Source)
/** * Does this site have more than one author * * Checks to see if more than one author has published posts. * * @since 3.2.0 * * @global wpdb $wpdb * * @return bool Whether or not we have more than one author */ function is_multi_author() { global $wpdb; if ( false === ( $is_multi_author = get_transient( 'is_multi_author' ) ) ) { $rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2"); $is_multi_author = 1 < count(="" $rows="" )="" 1="" :="" 0;="" set_transient(="" 'is_multi_author',="" $is_multi_author="" );="" }="" *="" *="" filter="" whether="" the="" site="" has="" more="" than="" one="" author="" with="" published="" posts.="" *="" *="" @since="" 3.2.0="" *="" *="" @param="" bool="" $is_multi_author="" whether="" $is_multi_author="" should="" evaluate="" as="" true.="" */="" return="" apply_filters(="" 'is_multi_author',="" (bool)="" $is_multi_author="" );="" }="">
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
3.2.0 | wp-includes/author-template.php:560 | 1 | 0 |
is_multi_author 为WP2原创文章,链接:https://www.wp2.cn/hook/is_multi_author-2/