wp_sitemaps_get_max_urls() WordPress Function

The wp_sitemaps_get_max_urls() function is used to get the maximum number of URLs that can be served in a single sitemap. This can be useful for limiting the number of URLs that are output in a sitemap to avoid exceeding the maximum allowed sitemap size.

wp_sitemaps_get_max_urls( string $object_type ) #

Gets the maximum number of URLs for a sitemap.


Parameters

$object_type

(string)(Required)Object type for sitemap to be filtered (e.g. 'post', 'term', 'user').


Top ↑

Return

(int) The maximum number of URLs.


Top ↑

Source

File: wp-includes/sitemaps.php

function wp_sitemaps_get_max_urls( $object_type ) {
	/**
	 * Filters the maximum number of URLs displayed on a sitemap.
	 *
	 * @since 5.5.0
	 *
	 * @param int    $max_urls    The maximum number of URLs included in a sitemap. Default 2000.
	 * @param string $object_type Object type for sitemap to be filtered (e.g. 'post', 'term', 'user').
	 */
	return apply_filters( 'wp_sitemaps_max_urls', 2000, $object_type );
}


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.