Repository navigation
Core-65593: Remove sitemap stylesheets - #12448
masteradhoc wants to merge 27 commits into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
This PR removes the XSLT-based sitemap stylesheet entirely. That aligns with Chrome's XSLT deprecation (https://developer.chrome.com/docs/web-platform/deprecating-xslt). But: per Chrome's own docs, type="text/css" continues to be supported (see "XML + CSS is not being removed"). So there's an open question for core: do we want to keep some human-readable sitemap styling via a CSS-based , or is dropping styling altogether the intended outcome here? |
|
Good question. Is CSS able to style the XML sufficiently? |
|
@westonruter worth a try IMO. I'd though suggest we'll split it so we can first get rid of the existing implementation and then see if and what we want to style it moving forward. |
It's possible to style the XML with CSS, but it's not possible to make the "links" actually work. However, Chrome & Firefox (and other browsers, AFAIK) don't support XLink in generic XML documents (they do in SVG and MathML)...so it wouldn't be possible for a user to click on a link in the sitemap index to load a specific sitemap, nor to click on a link in a specific sitemap to get to that URL on the site. |
|
@westonruter are we ready to move forward for now without styling? |
|
@masteradhoc @westonruter Have you seen the alternate PR I did that removes the need for browser-support of XSLT but still renders a human-readable version of the sitemaps by doing the XSLT server-side? |
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
|
There is a test failure: |
|
All of the methods that now no-op should probably also get |
peterwilsoncc
left a comment
There was a problem hiding this comment.
I've added a few notes inline but was repeating myself.
Each of the deprecated methods will need to call _deprecated_function( __METHOD__, '7.2.0' );
|
@westonruter @peterwilsoncc just saw this message displayed from chrome now by default if you still use XSLT
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stylesheet filters were only applied in methods that core no longer calls, and the two stylesheet content filters were not applied at all, so a plugin's callback on any of them was silently ignored. Apply all five where the sitemap and sitemap index XML is generated, so that a callback triggers a deprecation notice. A filter with no callbacks triggers nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Call _deprecated_function() in WP_Sitemaps_Renderer::get_sitemap_stylesheet_url() and get_sitemap_index_stylesheet_url(), matching the deprecated methods of WP_Sitemaps_Stylesheet. Previously a direct call only triggered a notice if a callback was added to the method's filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The $stylesheet and $stylesheet_index properties and the constructor of WP_Sitemaps_Renderer had their original @SInCE 5.5.0 tags replaced by @deprecated. Keep both, as is done for the deprecated methods. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the constructor's body was removed, not the class, and core still instantiates WP_Sitemaps_Renderer. Tagging the constructor as deprecated would cause IDEs and static analysis to flag every instantiation. Document the change with a @SInCE 7.2.0 note instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cover get_sitemap_stylesheet(), get_sitemap_index_stylesheet() and get_stylesheet_css(), each of which must return an empty string and trigger a deprecation notice. The previous tests for this class were removed along with the stylesheet content filters they exercised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The $stylesheet and $stylesheet_index properties are deprecated, not repurposed, so keep their original descriptions and only add @deprecated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The methods of WP_Sitemaps_Stylesheet are deprecated, not repurposed, so keep their original descriptions alongside the @deprecated tags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
peterwilsoncc
left a comment
There was a problem hiding this comment.
I've added a few notes inline, mainly the clarify that the filters don't do anything any more and possible test improvements.
Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
peterwilsoncc
left a comment
There was a problem hiding this comment.
I've pushed my docblock suggestions and this is now ready for commit.
Browser support for client-side XSLT is being deprecated and removed. For sites including an XSL stylesheet, the display of the XML sitemaps may fail. This removes the stylesheets in favour of allowing browsers to render them as they will. This change deprecates: * `WP_Sitemaps_Renderer::$stylesheet` * `WP_Sitemaps_Renderer::$stylesheet_index` * `WP_Sitemaps_Renderer::get_sitemap_stylesheet_url()` * `WP_Sitemaps_Renderer::get_sitemap_index_stylesheet_url()` * `WP_Sitemaps_Stylesheet` in its entirety * the `sitemap-stylesheet` rewrite tag * the `sitemap-stylesheet` query variable * the `*.xls` rewrite rules * the `wp_sitemaps_stylesheet_url` filter * the `wp_sitemaps_stylesheet_index_url` filter * the `wp_sitemaps_stylesheet_index_content` filter * the `wp_sitemaps_stylesheet_content` filter * the `wp_sitemaps_stylesheet_css` filter The outcome of the deprecated filters is ignored, the filters are now only fired in order to provide deprecation notices to developers. Developed in #12448 Props masteradhoc, pbiron, westonruter, peterwilsoncc. Fixes #65593. git-svn-id: https://develop.svn.wordpress.org/trunk@64073 602fd350-edb4-49c9-b593-d223f7449a82
Browser support for client-side XSLT is being deprecated and removed. For sites including an XSL stylesheet, the display of the XML sitemaps may fail. This removes the stylesheets in favour of allowing browsers to render them as they will. This change deprecates: * `WP_Sitemaps_Renderer::$stylesheet` * `WP_Sitemaps_Renderer::$stylesheet_index` * `WP_Sitemaps_Renderer::get_sitemap_stylesheet_url()` * `WP_Sitemaps_Renderer::get_sitemap_index_stylesheet_url()` * `WP_Sitemaps_Stylesheet` in its entirety * the `sitemap-stylesheet` rewrite tag * the `sitemap-stylesheet` query variable * the `*.xls` rewrite rules * the `wp_sitemaps_stylesheet_url` filter * the `wp_sitemaps_stylesheet_index_url` filter * the `wp_sitemaps_stylesheet_index_content` filter * the `wp_sitemaps_stylesheet_content` filter * the `wp_sitemaps_stylesheet_css` filter The outcome of the deprecated filters is ignored, the filters are now only fired in order to provide deprecation notices to developers. Developed in WordPress/wordpress-develop#12448 Props masteradhoc, pbiron, westonruter, peterwilsoncc. Fixes #65593. Built from https://develop.svn.wordpress.org/trunk@64073 git-svn-id: http://core.svn.wordpress.org/trunk@63232 1a063a9b-81f0-0310-95a4-ce76da25c4cd


Removes the sitemap XSL stylesheet feature from core. Chrome and other browsers are deprecating and removing XSLT support (https://developer.chrome.com/docs/web-platform/deprecating-xslt), so the
<?xml-stylesheet?>processing instruction pointing at/wp-sitemap.xsl//wp-sitemap-index.xslwill stop working for site visitors and no longer serves its purpose.After this change, generated sitemap XML no longer includes a stylesheet processing instruction, and the
/wp-sitemap.xsland/wp-sitemap-index.xslrewrite rules and thesitemap-stylesheetquery var are removed.Backward compatibility
WP_Sitemaps_Stylesheetis retained but deprecated. Each of its methods triggers a deprecation notice:render_stylesheet()sends a410 Gonestatus and exits, and the others return an empty string.WP_Sitemaps_Renderer::get_sitemap_stylesheet_url()andWP_Sitemaps_Renderer::get_sitemap_index_stylesheet_url()are deprecated and return an empty string.wp_sitemaps_stylesheet_url,wp_sitemaps_stylesheet_index_url,wp_sitemaps_stylesheet_content,wp_sitemaps_stylesheet_index_contentandwp_sitemaps_stylesheet_cssfilters are deprecated and no longer have any effect. They are still applied when sitemap XML is generated, so a plugin that hooks one gets a deprecation notice rather than being silently ignored.Trac ticket: https://core.trac.wordpress.org/ticket/65593
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Implementing the removal across
WP_Sitemaps,WP_Sitemaps_Renderer,canonical.php, andwp-settings.php, deleting the obsoleteWP_Sitemaps_Stylesheetclass, and updating/removing the associated PHPUnit tests. All changes were reviewed and tested by me.Follow-up commits by @westonruter also used Claude Code (Claude Opus 5.5) for the deprecation notices on the removed stylesheet filters and renderer URL methods, docblock fixes, and the accompanying tests. These were reviewed and directed by @westonruter.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.