# flywp/1.8.0/includes/StaticSite/Engine/Discovery/TaxonomySource.php

FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel, version 1.8.0. 59 lines.

- Page: https://pluginprobe.com/plugins/flywp/1.8.0/code/includes/StaticSite/Engine/Discovery/TaxonomySource.php
- Raw: https://pluginprobe.com/plugins/flywp/1.8.0/raw/includes/StaticSite/Engine/Discovery/TaxonomySource.php
- Modified: 2026-10-01T05:36:42+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/flywp/1.8.0/code/includes/StaticSite/Engine/Discovery/TaxonomySource.php#L10-L20`.

```php
<?php

namespace FlyWP\StaticSite\Engine\Discovery;

/**
 * Term archives of all public taxonomies, with pagination.
 *
 * Generator with term ID batches behind the gateway.
 *
 * @since 1.8.0
 */
class TaxonomySource implements UrlSource {

    /**
     * @var WordPressGateway
     */
    private $wp;

    /**
     * @var int
     */
    private $batch_size;

    /**
     * @param WordPressGateway $wp         Gateway.
     * @param int              $batch_size Terms in one query.
     */
    public function __construct( WordPressGateway $wp, $batch_size = 500 ) {
        $this->wp         = $wp;
        $this->batch_size = max( 1, (int) $batch_size );
    }

    /**
     * {@inheritdoc}
     */
    public function urls() {
        foreach ( $this->wp->public_taxonomies() as $taxonomy ) {
            $after_id = 0;

            do {
                $rows       = $this->wp->term_rows( $taxonomy, $after_id, $this->batch_size );
                $full_batch = count( $rows ) === $this->batch_size;

                foreach ( $rows as $row ) {
                    $after_id = $row['id'];
                    $link     = $this->wp->term_link( $row['id'], $taxonomy );

                    if ( null === $link ) {
                        continue;
                    }

                    yield new DiscoveredUrl( $link, 'term', 'term', $row['id'] );
                    yield from Pagination::urls( $this->wp, $link, $row['count'] );
                }
            } while ( $full_batch );
        }
    }
}

```
