Un motore di ricerca WordPress per sviluppatori e autori di temi



_count_posts_cache_key ›

Da3.9.0
Deprecaton/a
_count_posts_cache_key ( $type = 'post', $perm = '' )
Accedi:
  • private
Parametri: (2)
  • (string) $type Optional. Post type to retrieve count Default 'post'.
    Richiesto: No
    Default: 'post'
  • (string) $perm Optional. 'readable' or empty. Default empty.
    Richiesto: No
    Default: (vuoto)
Ritorna:
  • (string) The cache key.
Definito a:
Codex:

Return the cache key for wp_count_posts() based on the passed arguments.



Sorgenti

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;
}