Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#50644 closed defect (bug) (duplicate)

Changing Search Engine Visibility option does not immediately (de)activate sitemaps

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

Description

The "Discourage search engines from indexing this site" option in Settings -> Reading can be used to add noindex directives to the robots.txt file. At the same time, it also disables XML sitemaps, and prevents the feature from initializing in the first place.

That means if you have the option currently checked, and uncheck it, the sitemaps won't work until after you've flushed the rewrite rules.

Ideally, when the option is toggled we should flush the rewrite rules accordingly.

However, the option value can also be filtered programmatically using pre_option filters. Just like the wp_sitemaps_enabled filter can be used.

So maybe an alternative solution could be to always register the rewrite rules, even if the feature is disabled, but then handling the response codes (404 vs 200) accordingly.

Related: #50643

Change History (5)

#1 @johnbillion
5 years ago

  • Version set to trunk

#2 @swissspidy
5 years ago

The preliminary patch at #50643 might solve this one too.

#3 @swissspidy
5 years ago

  • Milestone changed from Awaiting Review to 5.5

This ticket was mentioned in Slack in #core-sitemaps by swissspidy. View the logs.


5 years ago

#5 @swissspidy
5 years ago

  • Keywords needs-patch removed
  • Milestone 5.5 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Closing as duplicate because the approach in #50643 will render this report here invalid.

Note: See TracTickets for help on using tickets.