# wordpress-seo/27.7/src/ai/content-planner/domain/post-list.php

Yoast SEO – Advanced SEO with real-time guidance and built-in AI, version 27.7. 42 lines.

- Page: https://pluginprobe.com/plugins/wordpress-seo/27.7/code/src/ai/content-planner/domain/post-list.php
- Raw: https://pluginprobe.com/plugins/wordpress-seo/27.7/raw/src/ai/content-planner/domain/post-list.php
- Modified: 2026-04-28T14:11:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wordpress-seo/27.7/code/src/ai/content-planner/domain/post-list.php#L10-L20`.

```php
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\AI\Content_Planner\Domain;

/**
 * List of posts.
 */
class Post_List {

	/**
	 * The posts.
	 *
	 * @var array<Post>
	 */
	private $posts = [];

	/**
	 * Adds a post to the list.
	 *
	 * @param Post $post A post.
	 *
	 * @return void
	 */
	public function add( Post $post ): void {
		$this->posts[] = $post;
	}

	/**
	 * Returns this object in array format.
	 *
	 * @return array<array<string, string|bool|array<string, int>>> The posts as an array.
	 */
	public function to_array(): array {
		$result = [];
		foreach ( $this->posts as $post ) {
			$result[] = $post->to_array();
		}

		return $result;
	}
}

```
