# gutenberg/22.9.0/build/scripts/block-library/query-pagination.php

Gutenberg, version 22.9.0. 52 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/22.9.0/code/build/scripts/block-library/query-pagination.php
- Raw: https://pluginprobe.com/plugins/gutenberg/22.9.0/raw/build/scripts/block-library/query-pagination.php
- Modified: 2025-11-05T15:23:32+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/gutenberg/22.9.0/code/build/scripts/block-library/query-pagination.php#L10-L20`.

```php
<?php
/**
 * Server-side rendering of the `core/query-pagination` block.
 *
 * @package WordPress
 */

/**
 * Renders the `core/query-pagination` block on the server.
 *
 * @since 5.9.0
 *
 * @param array  $attributes Block attributes.
 * @param string $content    Block default content.
 *
 * @return string Returns the wrapper for the Query pagination.
 */
function gutenberg_render_block_core_query_pagination( $attributes, $content ) {
	if ( empty( trim( $content ) ) ) {
		return '';
	}

	$classes            = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
	$wrapper_attributes = get_block_wrapper_attributes(
		array(
			'aria-label' => __( 'Pagination' ),
			'class'      => $classes,
		)
	);

	return sprintf(
		'<nav %1$s>%2$s</nav>',
		$wrapper_attributes,
		$content
	);
}

/**
 * Registers the `core/query-pagination` block on the server.
 *
 * @since 5.8.0
 */
function gutenberg_register_block_core_query_pagination() {
	register_block_type_from_metadata(
		__DIR__ . '/query-pagination',
		array(
			'render_callback' => 'gutenberg_render_block_core_query_pagination',
		)
	);
}
add_action( 'init', 'gutenberg_register_block_core_query_pagination', 20 );

```
