Yoast\WP\SEO\Helpers
User_Helper::count_posts()
Counts the number of posts the user has written in this post type.
Метод класса: User_Helper{}
Хуков нет.
Возвращает
int
. The number of posts the user has written in this post type.
Использование
$User_Helper = new User_Helper(); $User_Helper->count_posts( $user_id, $post_type );
- $user_id(int) (обязательный)
- User ID.
- $post_type(массив|строка)
- Single post type or array of post types to count the number of posts for.
По умолчанию: 'post'
Код User_Helper::count_posts() User Helper::count posts Yoast 22.4
public function count_posts( $user_id, $post_type = 'post' ) { return (int) \count_user_posts( $user_id, $post_type, true ); }