Yoast\WP\SEO\Helpers
Author_Archive_Helper::author_has_public_posts()
Returns whether the author has at least one public post.
Метод класса: Author_Archive_Helper{}
Хуков нет.
Возвращает
true|false|null
. Whether the author has at least one public post.
Использование
$Author_Archive_Helper = new Author_Archive_Helper(); $Author_Archive_Helper->author_has_public_posts( $author_id );
- $author_id(int) (обязательный)
- The author ID.
Код Author_Archive_Helper::author_has_public_posts() Author Archive Helper::author has public posts Yoast 24.9
public function author_has_public_posts( $author_id ) { // First check if the author has at least one public post. $has_public_post = $this->author_has_a_public_post( $author_id ); if ( $has_public_post ) { return true; } // Then check if the author has at least one post where the status is the same as the global setting. $has_public_post_depending_on_the_global_setting = $this->author_has_a_post_with_is_public_null( $author_id ); if ( $has_public_post_depending_on_the_global_setting ) { return null; } return false; }