_count_posts_cache_key
函数
_count_posts_cache_key ( $type = 'post', $perm = '' )
- Access
- Private
- 参数
-
-
(string)
$type
Optional. Post type to retrieve count Default ‘post’.- Required: 否
- Default: ‘post’
-
(string)
$perm
Optional. ‘readable’ or empty. Default empty.- Required: 否
- Default: (empty)
-
(string)
- 返回值
-
- (string) The cache key.
- 定义位置
-
-
wp-includes/post.php
, line 2981
-
wp-includes/post.php
- 引入
- 3.9.0
- 弃用
- –
Returns the cache key for wp_count_posts() based on the passed arguments.
function _count_posts_cache_key( $type = 'post', $perm = '' ) { $cache_key = 'posts-' . $type; if ( 'readable' === $perm && is_user_logged_in() ) { $post_type_object = get_post_type_object( $type ); if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) { $cache_key .= '_' . $perm . '_' . get_current_user_id(); } } return $cache_key; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。