Make WordPress Core

Opened 2 weeks ago

Closed 2 weeks ago

Last modified 2 weeks ago

#62071 closed feature request (worksforme)

Add custom sitemap function to wordpress 6.7

Reported by: phanduynam's profile phanduynam Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Sitemaps Keywords:
Focuses: Cc:

Description

I know WordPress currently has the function of generating sitemap without installing any plugin. But there is no option to customize the sitemap like split sitemap, limit the number of urls on 1 sitemap, do not get sitemap in some urls. For example, I currently have a product sitemap with 10,000 urls, but I want to split it into 10 sitemaps with 1,000 urls, there is no such option. Or if I do not want to get author sitemap, there is no option to remove it. So please add this feature in WordPress version 6.7.

Change History (2)

#1 follow-up: @swissspidy
2 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

You can use the wp_sitemaps_add_provider filter to prevent the users (authors) sitemap from being added.

You can uses filters such as wp_sitemaps_max_urls, wp_sitemaps_posts_query_args, wp_sitemaps_posts_pre_max_num_pages, and wp_sitemaps_posts_pre_url_list to further customize and short-circuit behavior.

So what you are looking for is already possible.

#2 in reply to: ↑ 1 @phanduynam
2 weeks ago

that means i have to edit the code right? but what i want is a solution built into wordpress not to edit the code

Replying to swissspidy:

You can use the wp_sitemaps_add_provider filter to prevent the users (authors) sitemap from being added.

You can uses filters such as wp_sitemaps_max_urls, wp_sitemaps_posts_query_args, wp_sitemaps_posts_pre_max_num_pages, and wp_sitemaps_posts_pre_url_list to further customize and short-circuit behavior.

So what you are looking for is already possible.

Note: See TracTickets for help on using tickets.