Yoast\WP\SEO\Task_List\Application\Tasks

Delete_Hello_World::get_is_completedpublicYoast 1.0

Returns whether this task is completed.

Метод класса: Delete_Hello_World{}

Хуков нет.

Возвращает

true|false. Whether this task is completed.

Использование

$Delete_Hello_World = new Delete_Hello_World();
$Delete_Hello_World->get_is_completed(): bool;

Код Delete_Hello_World::get_is_completed() Yoast 27.7

public function get_is_completed(): bool {
	$post = \get_post( 1 );
	if ( $post instanceof WP_Post === false || $post->post_status !== 'publish' ) {
		return true;
	}

	// Check if this is the actual Hello World post by checking the first comment.
	$comments = \get_comments(
		[
			'post_id' => 1,
			'number'  => 1,
			'order'   => 'ASC',
		],
	);

	if ( empty( $comments ) || \is_a( $comments[0], WP_Comment::class ) === false || $comments[0]->comment_author_email !== 'wapuu@wordpress.example' ) {
		// Not the Hello World post, so consider task completed.
		return true;
	}

	return $post->post_date !== $post->post_modified;
}