Repository navigation
fix: don't advertise the oEmbed endpoint in <head> - #498
Merged
Merged
Conversation
Crawlers follow the oEmbed discovery links, and every request is a full REST boot that ends in a 401 for anonymous visitors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WordPress prints
<link rel="alternate" type="application/json+oembed" …>(andtext/xml+oembed) in every page's<head>. Crawlers follow them, and every such request is a full WordPress REST boot that ends in a 401, because REST is restricted for anonymous visitors. Measured on two shops: 1.2k requests / 1.6k PHP-seconds a day on one, 1.7k / 1.0k on the other.The only thing lost: another WordPress site can no longer auto-embed these pages as rich oEmbed cards. Social networks use Open Graph, not oEmbed, so link previews are unaffected.
Change
remove_action('wp_head', 'wp_oembed_add_discovery_links')inweb/app/mu-plugins/defaults.php, next to the otherwp_headcleanups (emoji removal). A fleet default, same file and shape as https://github.com/generoi/gorans/pull/102.Testing
php -lpasses.wp eval 'var_dump(has_action("wp_head", "wp_oembed_add_discovery_links"));'should printbool(false), and a page's<head>no longer contains+oembed(purge the page cache first).🤖 Generated with Claude Code