[wp-trac] [WordPress Trac] #50644: Changing Search Engine Visibility option does not immediately (de)activate sitemaps
WordPress Trac
noreply at wordpress.org
Mon Jul 13 08:48:52 UTC 2020
#50644: Changing Search Engine Visibility option does not immediately (de)activate
sitemaps
--------------------------+-----------------------------
Reporter: swissspidy | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Sitemaps | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
--------------------------+-----------------------------
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
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50644>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list