Yoast\WP\SEO\Schema_Aggregator\User_Interface

Site_Schema_Aggregator_Cli_Command::aggregate_site_schemapublicYoast 1.0

Aggregates the schema for a certain site.

OPTIONS

[--page=<page>]
The current page to process.
--- default: 1
---
[--per_page=<per_page>]
How many items to process per page.
--- default: 100
---
[--post_type=<post_type>]
The post type to aggregate schema for.
--- default: 'post'
---

EXAMPLES

wp yoast aggregate_site_schema

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$Site_Schema_Aggregator_Cli_Command = new Site_Schema_Aggregator_Cli_Command();
$Site_Schema_Aggregator_Cli_Command->aggregate_site_schema( $args, $assoc_args );
$args(array|null)
The arguments.
По умолчанию: null
$assoc_args(array|null)
The associative arguments.
По умолчанию: null

Код Site_Schema_Aggregator_Cli_Command::aggregate_site_schema() Yoast 28.3

public function aggregate_site_schema( $args = null, $assoc_args = null ) {
	if ( isset( $assoc_args['page'] ) && (int) $assoc_args['page'] < 1 ) {
		WP_CLI::error( \__( 'The value for \'page\' must be a positive integer higher than equal to 1.', 'wordpress-seo' ) );
	}
	if ( isset( $assoc_args['per_page'] ) && (int) $assoc_args['per_page'] < 1 ) {
		WP_CLI::error( \__( 'The value for \'per_page\' must be a positive integer higher than equal to 1.', 'wordpress-seo' ) );
	}
	$page      = (int) $assoc_args['page'];
	$per_page  = (int) $assoc_args['per_page'];
	$post_type = $assoc_args['post_type'];
	try {
		$result = $this->aggregate_site_schema_command_handler->handle( new Aggregate_Site_Schema_Command( $page, $per_page, $post_type ) );
	} catch ( Exception $exception ) {
		WP_CLI::error( \__( 'An error occurred while aggregating the site schema.', 'wordpress-seo' ) );
	}
	$output = WPSEO_Utils::format_json_encode( $result );
	$output = \str_replace( "\n", \PHP_EOL . "\t", $output );
	WP_CLI::log(
		$output,
	);
}