WPSEO_Tracking_Default_Data::get_post_count
Returns the number of posts of a certain type.
Метод класса: WPSEO_Tracking_Default_Data{}
Хуков нет.
Возвращает
int. The count for this post type.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_post_count( $post_type );
- $post_type(строка) (обязательный)
- The post type return the count for.
Код WPSEO_Tracking_Default_Data::get_post_count() WPSEO Tracking Default Data::get post count Yoast 27.4
protected function get_post_count( $post_type ) {
$count = wp_count_posts( $post_type );
if ( isset( $count->publish ) ) {
return $count->publish;
}
return 0;
}